From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.32.114; helo=nam01-sn1-obe.outbound.protection.outlook.com; envelope-from=christopher.co@microsoft.com; receiver=edk2-devel@lists.01.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0114.outbound.protection.outlook.com [104.47.32.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8ACAF210C0CD2 for ; Sat, 21 Jul 2018 18:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/AT3viwOX8WTKcga4ECNWLDVut2Es81gAPQB56+xjvM=; b=LcK4vIHHLU4bXnPysXWoVqARgj25dbDjYvrNSmI14HhsDI6E2I3oY/D9x7DAkIzgPUPIaVIcD5cZlxQ/LVrgULlAzbElvTc8JM2yjJVvi1IaUF0hI9CA7vPm/bnRaT8JBbIOFr1n9loEu9w6dmw9Ee0uGTSO0Ea4bWggX+BCsis= Received: from DM5PR2101MB1128.namprd21.prod.outlook.com (52.132.133.20) by DM5PR2101MB0998.namprd21.prod.outlook.com (52.132.133.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.995.1; Sun, 22 Jul 2018 01:30:35 +0000 Received: from DM5PR2101MB1128.namprd21.prod.outlook.com ([fe80::b4d3:dabb:9372:9740]) by DM5PR2101MB1128.namprd21.prod.outlook.com ([fe80::b4d3:dabb:9372:9740%3]) with mapi id 15.20.1017.000; Sun, 22 Jul 2018 01:30:35 +0000 From: Chris Co To: "edk2-devel@lists.01.org" CC: Michael D Kinney , Ard Biesheuvel , Leif Lindholm Thread-Topic: [PATCH edk2-platforms 2/4] Platform/Solidrun: Add Hummingboard Peripheral Initialization Thread-Index: AQHUIVuW/HKWUA9R+0SHXUcIodO0xA== Date: Sun, 22 Jul 2018 01:30:35 +0000 Message-ID: <20180722013021.10788-3-christopher.co@microsoft.com> References: <20180722013021.10788-1-christopher.co@microsoft.com> In-Reply-To: <20180722013021.10788-1-christopher.co@microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR14CA0020.namprd14.prod.outlook.com (2603:10b6:300:ae::30) To DM5PR2101MB1128.namprd21.prod.outlook.com (2603:10b6:4:a8::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2001:4898:80e8:9:354a:3e34:47dd:ceb4] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0998; 6:S4QH05LW9ygBkhYaxueeDGJhsNXvq7CHIHM6dMZNw6Bup/GcGPmGOGlhtvnt0lvegvZ+4xQTy0irswXeB2srjOKaq3brl3zDymxE2fE8cnNjrXF2P1N46ejETFXBcwvk0MFhxUwcSiaqASdVwiQgyr6IFwlLYV65EZ2EwhSrt7i3W3Y+neJwaYorQZLOa5pJQYYr5uk40JoUNrKaJMY0Bqj/hKO57pwFfWm4hBlT+3uCLGG2ESBYFU+68z1JVN1XVNkc248mZpuzZAAKBBUXtajkC8gPFCyFLQHDm6C1ihShWhDc7xuiAshmbaOshpI/4EBmRcHTu2qcr9pZFqaNyGZH1a3qlUQOghAutaDSGtACnOsIfHebqygfzqTEHZ9hSzzsjW4ZF/O/QKMZY9neik22lr5hye81kUmhmQv3CzWdmhk1/fJ2DnYFoX9emN41Nq/o/hFfhS6nghEyTJkXsg==; 5:JpLKH6qO90bhT/0bV2qAzWcW74BDSTfRuL5vKV3h1yjYCbts05Lt6Vhn9VaLD/mZpfn3eG2TfK7K6pVsILxU8ZYeY5XOx/BXMYADOFTVPp8lpJsz8VJQvUxjgsyJnDERhGh9bhTf9848p6C75bVyf7hUp8TonkfnHAYqlre+gHQ=; 7:I3plZEPKL94tIuuVGNnEuupXpN0V+hJx0SUCknJb3Qyy5LH35edxlRlRReGVNLvuospF5nzvH5aJHRU05eJWG2u31/+etq07POsBgqoppf5GMevRDgNsWRPt3vEGhJsw8VFlqaaHoA19kaADwWhsRftyVqSCZ+IyFhxSx3vV9td0ytz5OOjM5BWpEIm9V0cNrHbrIBB4L9hgqm5jvyuwjvgYBN3i9c/J3POkl9eNDJl4QJw7MHzqh3LWXm91+1A/ x-ms-office365-filtering-correlation-id: 90446cab-a6cc-41d1-9ece-08d5ef72b8c9 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600073)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7193020); SRVR:DM5PR2101MB0998; x-ms-traffictypediagnostic: DM5PR2101MB0998: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Christopher.Co@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231311)(944501410)(52105095)(2018427008)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:DM5PR2101MB0998; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0998; x-forefront-prvs: 0741C77572 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(396003)(39860400002)(136003)(199004)(189003)(53376002)(19627235002)(256004)(15188155005)(105586002)(2906002)(14444005)(106356001)(76176011)(1076002)(72206003)(5250100002)(7736002)(186003)(5660300001)(99286004)(4326008)(305945005)(46003)(2900100001)(2616005)(53936002)(81156014)(81166006)(6512007)(14454004)(6306002)(86612001)(2351001)(11346002)(102836004)(2501003)(25786009)(6486002)(446003)(68736007)(16200700003)(53946003)(5640700003)(966005)(54906003)(476003)(10090500001)(486006)(478600001)(6116002)(386003)(6506007)(36756003)(16799955002)(6916009)(10290500003)(6436002)(316002)(22452003)(8936002)(52116002)(8676002)(97736004)(86362001)(559001)(579004)(569006); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0998; H:DM5PR2101MB1128.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Uvd9ju2Rjnd+1fjMqNfn2CAASvB3i2LCid/d0QIZV5/IstSg3/PCmlkFhqh1Oo1HDGySWqAG4GZxzZUAm9vgsb8YUhXvnUpbuYDSzKeolLVMl3z23wtoFHa6iREmf6q4F135cs+gHiImianrRQ7bKcJusNMataVcWJdaL3aCqiLAG++ynW7uR/W08+wBPpwzQiDHRbsqgQz/rpVLI37f0gexM5jA6qR8X1Astk+HmFUB1+9bjsSlwlvMqJeWA0aO6skjfBE+9VdsWcCEciCytxb0ov1Rxnue26vkTd2xfVzlOpf/sv8AKDkCQIXpncp1u2go27xjM0CQCcU8XqAOVlyL9/j9e9pLb0ENChUtzQs= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90446cab-a6cc-41d1-9ece-08d5ef72b8c9 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jul 2018 01:30:35.5859 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0998 Subject: [PATCH edk2-platforms 2/4] Platform/Solidrun: Add Hummingboard Peripheral Initialization X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jul 2018 01:30:39 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable This adds support to initialize the different peripherals on the Solidrun i.MX6Q Hummingboard Edge. It will initialize the pad mux and clocks for the different peripherals. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christopher Co Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Leif Lindholm --- Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Library/iMX6BoardLib/iMX6Boar= dInit.c | 1295 ++++++++++++++++++++ Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Library/iMX6BoardLib/iMX6Boar= dLib.inf | 96 ++ 2 files changed, 1391 insertions(+) diff --git a/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Library/iMX6Board= Lib/iMX6BoardInit.c b/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Library/= iMX6BoardLib/iMX6BoardInit.c new file mode 100644 index 000000000000..137d05674963 --- /dev/null +++ b/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Library/iMX6BoardLib/iMX= 6BoardInit.c @@ -0,0 +1,1295 @@ +/** @file +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* Copyright 2018 NXP +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD License +* which accompanies this distribution. The full text of the license may = be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +* +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#define DEBUG_SDHC_PINMUXING 0 + +RETURN_STATUS +EFIAPI +TimerConstructor ( + VOID + ); + +/* + Prebaked pad configurations that include mux and drive settings where + each enum named as IMX__PADCFG contains configurations + for pads used by that module +*/ +typedef enum { + IMX_PAD_ENET_MDIO_ENET_MDIO =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_ENABLE, + IMX_PKE_DISABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_ENET_MDIO_ALT1_ENET_MDIO), + + IMX_PAD_ENET_MDC_ENET_MDC =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_ENET_MDC_ALT1_ENET_MDC), + + IMX_PAD_CFG_KEY_ROW4_GPIO4_IO15 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PD, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_KEY_ROW4_ALT5_GPIO4_IO15), + + IMX_PAD_DI0_PIN2_GPIO4_IO18 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PD, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_DI0_PIN2_ALT5_GPIO4_IO18), + + IMX_PAD_GPIO_16_ENET_REF_CLK =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_GPIO_16_ALT2_ENET_REF_CLK, + IOMUXC_ENET_REF_CLK_SELECT_INPUT, + GPIO16_ALT2), + + IMX_PAD_RGMII_TXC_RGMII_TXC =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_TXC_ALT1_RGMII_TXC), + + IMX_PAD_RGMII_TD0_RGMII_TD0 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_TD0_ALT1_RGMII_TD0), + + IMX_PAD_RGMII_TD1_RGMII_TD1 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_TD1_ALT1_RGMII_TD1), + + IMX_PAD_RGMII_TD2_RGMII_TD2 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_TD2_ALT1_RGMII_TD2), + + IMX_PAD_RGMII_TD3_RGMII_TD3 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_TD3_ALT1_RGMII_TD3), + + IMX_PAD_RGMII_TX_CTL_RGMII_TX_CTL =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_TX_CTL_ALT1_RGMII_TX_CTL), + + IMX_PAD_ENET_REF_CLK_ENET_REF_CLK =3D _IMX_MAKE_PADCFG( + IMX_SRE_FAST, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PD, + IMX_HYS_DISABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_ENET_REF_CLK_ALT1_ENET_TX_CLK), + + IMX_PAD_RGMII_RXC_ENET_RGMII_RXC =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_RXC_ALT1_RGMII_RXC), + + IMX_PAD_RGMII_RD0_ENET_RGMII_RD0 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PD, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_RD0_ALT1_RGMII_RD0), + + IMX_PAD_RGMII_RD1_ENET_RGMII_RD1 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PD, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_RD1_ALT1_RGMII_RD1), + + IMX_PAD_RGMII_RD2_ENET_RGMII_RD2 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_RD2_ALT1_RGMII_RD2), + + IMX_PAD_RGMII_RD3_ENET_RGMII_RD3 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_RD3_ALT1_RGMII_RD3), + + IMX_PAD_RGMII_RX_CTL_RGMII_RX_CTL =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_KEEP, + IMX_PUS_100K_OHM_PD, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_RGMII_RX_CTL_ALT1_RGMII_RX_CTL), +} IMX_ENET_PADCFG; + +typedef enum { + IMX_PAD_CFG_EIM_DATA22_GPIO3_IO22_USB_OTG_PWR =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_EIM_D22_ALT5_GPIO3_IO22), + + IMX_PAD_CFG_KEY_COL4_USB_OTG_OC =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_LOW, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_KEY_COL4_ALT2_USB_OTG_OC, + IOMUXC_USB_OTG_OC_SELECT_INPUT, + KEY_COL4_ALT2), + + IMX_PAD_CFG_GPIO0_GPIO1_IO0_USBH1_PWR =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_GPIO_0_ALT5_GPIO1_IO00), + + IMX_PAD_CFG_GPIO01_USB_OTG_ID_HOST =3D _IMX_MAKE_PADCFG( + IMX_SRE_FAST, + IMX_DSE_90_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PD, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_GPIO_1_ALT3_USB_OTG_ID), + + IMX_PAD_CFG_GPIO01_USB_OTG_ID_DEVICE =3D _IMX_MAKE_PADCFG( + IMX_SRE_FAST, + IMX_DSE_90_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_GPIO_1_ALT3_USB_OTG_ID), +} IMX_EHCI_PADCFG; + +typedef enum { + IMX_PAD_CFG_SD4_DATA3_GPIO2_IO11 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_SD4_DAT3_ALT5_GPIO2_IO11), +} IMX_IMX6Q_PCIE_PADCFG; + +typedef enum { + IMX_PAD_CFG_EIM_EB3_GPIO2_IO31 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_260_OHM, + IMX_SPEED_LOW, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_DISABLED, + IMX_SION_ENABLED, + IMX_IOMUXC_EIM_EB3_ALT5_GPIO2_IO31), + + IMX_PAD_CFG_EIM_D21_I2C1_SCL =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_FAST, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_ENABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_47K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_ENABLED, + IMX_IOMUXC_EIM_D21_ALT6_I2C1_SCL, + IOMUXC_I2C1_SCL_IN_SELECT_INPUT, + EIM_DATA21_ALT6), + + IMX_PAD_CFG_EIM_D28_I2C1_SDA =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_FAST, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_ENABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_47K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_ENABLED, + IMX_IOMUXC_EIM_D28_ALT1_I2C1_SDA, + IOMUXC_I2C1_SDA_IN_SELECT_INPUT, + EIM_DATA28_ALT1), + + IMX_PAD_CFG_EIM_D17_I2C3_SCL =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_FAST, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_ENABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_47K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_ENABLED, + IMX_IOMUXC_EIM_D17_ALT6_I2C3_SCL, + IOMUXC_I2C3_SCL_IN_SELECT_INPUT, + EIM_DATA17_ALT6), + + IMX_PAD_CFG_EIM_D18_I2C3_SDA =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_FAST, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_ENABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_47K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_ENABLED, + IMX_IOMUXC_EIM_D18_ALT6_I2C3_SDA, + IOMUXC_I2C3_SDA_IN_SELECT_INPUT, + EIM_DATA18_ALT6), +} IMX_I2C_PADCFG; + +typedef enum { + IMX_PAD_CFG_GPIO_5_CCM_CLKO1 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_GPIO_5_ALT3_CCM_CLKO1), + + IMX_PAD_CFG_KEY_COL0_AUD5_TXC =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_KEY_COL0_ALT2_AUD5_TXC, + IOMUXC_AUD5_INPUT_TXCLK_AMX_SELECT_INPUT, + KEY_COL0_ALT2), + + IMX_PAD_CFG_KEY_ROW0_AUD5_TXD =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_KEY_ROW0_ALT2_AUD5_TXD, + IOMUXC_AUD5_INPUT_DB_AMX_SELECT_INPUT, + KEY_ROW0_ALT2), + + IMX_PAD_CFG_KEY_COL1_AUD5_TXFS =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_KEY_COL1_ALT2_AUD5_TXFS, + IOMUXC_AUD5_INPUT_TXFS_AMX_SELECT_INPUT, + KEY_COL1_ALT2), + + IMX_PAD_CFG_DISP0_DAT19_AUD5_RXD =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_DISP0_DAT19_ALT3_AUD5_RXD, + IOMUXC_AUD5_INPUT_DA_AMX_SELECT_INPUT, + DISP0_DATA19_ALT3), +} IMX_AUDIO_PADCFG; + +typedef enum { + IMX_USDHC_CMD_PAD_CTL =3D _IMX_MAKE_PAD_CTL( + IMX_SRE_FAST, + IMX_DSE_33_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_47K_OHM_PU, + IMX_HYS_ENABLED), + + IMX_USDHC_CLK_PAD_CTL =3D _IMX_MAKE_PAD_CTL( + IMX_SRE_FAST, + IMX_DSE_33_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + 0, + 0, + IMX_HYS_ENABLED), + + IMX_USDHC_DAT_PAD_CTL =3D _IMX_MAKE_PAD_CTL( + IMX_SRE_FAST, + IMX_DSE_33_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_47K_OHM_PU, + IMX_HYS_ENABLED), + + IMX_USDHC_GPIO_PAD_CTL =3D _IMX_MAKE_PAD_CTL( + IMX_SRE_FAST, + IMX_DSE_33_OHM, + IMX_SPEED_LOW, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + 0, + 0, + IMX_HYS_ENABLED), + + IMX_USDHC_CD_PAD_CTL =3D _IMX_MAKE_PAD_CTL( + IMX_SRE_FAST, + IMX_DSE_33_OHM, + IMX_SPEED_LOW, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_47K_OHM_PU, + IMX_HYS_ENABLED), + + IMX_PAD_CFG_SD2_CLK_SD2_CLK =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_CLK_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD2_CLK_ALT0_SD2_CLK), + + IMX_PAD_CFG_SD2_CMD_SD2_CMD =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_CMD_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD2_CMD_ALT0_SD2_CMD), + + IMX_PAD_CFG_SD2_DAT0_SD2_DATA0 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD2_DAT0_ALT0_SD2_DATA0), + + IMX_PAD_CFG_SD2_DAT1_SD2_DATA1 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD2_DAT1_ALT0_SD2_DATA1), + + IMX_PAD_CFG_SD2_DAT2_SD2_DATA2 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD2_DAT2_ALT0_SD2_DATA2), + + IMX_PAD_CFG_SD2_DAT3_SD2_DATA3 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD2_DAT3_ALT0_SD2_DATA3), + + IMX_PAD_CFG_KEY_ROW1_SD2_VSELECT =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_GPIO_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_KEY_ROW1_ALT6_SD2_VSELECT), + + IMX_PAD_CFG_GPIO_4_SD2_CD_B =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_CD_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_GPIO_4_ALT6_SD2_CD_B), + + IMX_PAD_CFG_DISP0_DAT9_GPIO4_IO30 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_GPIO_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_DISP0_DAT9_ALT5_GPIO4_IO30), +} IMX_USDHC2_PADCFG; + +typedef enum { + IMX_PAD_CFG_SD3_CLK_SD3_CLK =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_CLK_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_CLK_ALT0_SD3_CLK), + + IMX_PAD_CFG_SD3_CMD_SD3_CMD =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_CMD_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_CMD_ALT0_SD3_CMD), + + IMX_PAD_CFG_SD3_RST_SD3_RST =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_GPIO_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_RST_ALT0_SD3_RESET), + + IMX_PAD_CFG_SD3_DAT0_SD3_DATA0 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_DAT0_ALT0_SD3_DATA0), + + IMX_PAD_CFG_SD3_DAT1_SD3_DATA1 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_DAT1_ALT0_SD3_DATA1), + + IMX_PAD_CFG_SD3_DAT2_SD3_DATA2 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_DAT2_ALT0_SD3_DATA2), + + IMX_PAD_CFG_SD3_DAT3_SD3_DATA3 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_DAT3_ALT0_SD3_DATA3), + + IMX_PAD_CFG_SD3_DAT4_SD3_DATA4 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_DAT4_ALT0_SD3_DATA4), + + IMX_PAD_CFG_SD3_DAT5_SD3_DATA5 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_DAT5_ALT0_SD3_DATA5), + + IMX_PAD_CFG_SD3_DAT6_SD3_DATA6 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_DAT6_ALT0_SD3_DATA6), + + IMX_PAD_CFG_SD3_DAT7_SD3_DATA7 =3D _IMX_MAKE_PADCFG2( + IMX_USDHC_DAT_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_SD3_DAT7_ALT0_SD3_DATA7), +} IMX_USDHC3_PADCFG; + +typedef enum { + IMX_PWM_CLK_PAD_CTL =3D _IMX_MAKE_PAD_CTL( + IMX_SRE_FAST, + IMX_DSE_33_OHM, + IMX_SPEED_LOW, + IMX_ODE_DISABLE, + IMX_PKE_DISABLE, + 0, + 0, + IMX_HYS_ENABLED), + + IMX_PAD_CFG_DISP0_DAT8_PWM1_OUT =3D _IMX_MAKE_PADCFG2( + IMX_PWM_CLK_PAD_CTL, + IMX_SION_DISABLED, + IMX_IOMUXC_DISP0_DAT8_ALT2_PWM1_OUT), +} IMX_PWM_PADCFG; + +typedef enum { + IMX_PAD_UART1_RX_DATA =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, // 110 40_OHM - 25 Ohm= @ 3.3V, 40 Ohm @ 1.8V + IMX_SPEED_MEDIUM, // 10 MEDIUM - Medium = frequency (100, 150 MHz) + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, // 12=3D1 ENABLED - Pu= ll/Keeper Enabled + IMX_PUE_PULL, // 13=3D1 PULL - Pull = Enabled + IMX_PUS_100K_OHM_PU, // 14-15 10 - 100K Ohm= Pull Up + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_CSI0_DAT11_ALT3_UART1_RX_DATA, + IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT, + CSI0_DATA11_ALT3), + + IMX_PAD_UART1_TX_DATA =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_CSI0_DAT10_ALT3_UART1_TX_DATA), + + IMX_PAD_UART3_RX_DATA =3D _IMX_MAKE_PADCFG_INPSEL( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_EIM_D25_ALT2_UART3_RX_DATA, + IOMUXC_UART3_UART_RX_DATA_SELECT_INPUT, + EIM_DATA25_ALT2), + + IMX_PAD_UART3_TX_DATA =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_EIM_D24_ALT2_UART3_TX_DATA), +} IMX_UART_PADCFG; + +typedef enum { + IMX_PAD_CFG_SD4_DATA1_GPIO2_IO09 =3D _IMX_MAKE_PADCFG( + IMX_SRE_SLOW, + IMX_DSE_40_OHM, + IMX_SPEED_MEDIUM, + IMX_ODE_DISABLE, + IMX_PKE_ENABLE, + IMX_PUE_PULL, + IMX_PUS_100K_OHM_PU, + IMX_HYS_ENABLED, + IMX_SION_DISABLED, + IMX_IOMUXC_SD4_DAT1_ALT5_GPIO2_IO09), + +} IMX_IMX6Q_LDB_PADCFG; + +/** + Turn off clock gates which are not needed during boot. The PEP is respon= sible + to ungate clocks as needed. +**/ +static VOID GateUnusedClocks () +{ + static const IMX_CLK_GATE gatesToTurnOff[] =3D { + IMX_ASRC_CLK_ENABLE, + IMX_CAN1_CLK_ENABLE, + IMX_CAN1_SERIAL_CLK_ENABLE, + IMX_CAN2_CLK_ENABLE, + IMX_CAN2_SERIAL_CLK_ENABLE, + IMX_DCIC1_CLK_ENABLE, + IMX_DCIC2_CLK_ENABLE, + IMX_DTCP_CLK_ENABLE, + IMX_ECSPI1_CLK_ENABLE, + IMX_ECSPI2_CLK_ENABLE, + IMX_ECSPI3_CLK_ENABLE, + IMX_ECSPI4_CLK_ENABLE, + IMX_ECSPI5_CLK_ENABLE, + IMX_ENET_CLK_ENABLE, + IMX_ESAI_CLK_ENABLE, + IMX_I2C1_SERIAL_CLK_ENABLE, + IMX_I2C2_SERIAL_CLK_ENABLE, + IMX_I2C3_SERIAL_CLK_ENABLE, + IMX_IIM_CLK_ENABLE, + IMX_IPSYNC_IP2APB_TZASC1_IPG_MASTER_CLK_ENABLE, + IMX_IPSYNC_IP2APB_TZASC2_IPG_MASTER_CLK_ENABLE, + IMX_IPSYNC_VDOA_IPG_MASTER_CLK_ENABLE, + IMX_IPU1_DI1_CLK_ENABLE, + IMX_IPU2_CLK_ENABLE, + IMX_IPU2_DI0_CLK_ENABLE, + IMX_IPU2_DI1_CLK_ENABLE, + IMX_LDB_DI0_CLK_ENABLE, + IMX_LDB_DI1_CLK_ENABLE, + IMX_MIPI_CORE_CFG_CLK_ENABLE, + IMX_MLB_CLK_ENABLE, + IMX_PL301_MX6QPER1_BCHCLK_ENABLE, + IMX_PWM2_CLK_ENABLE, + IMX_PWM3_CLK_ENABLE, + IMX_PWM4_CLK_ENABLE, + IMX_RAWNAND_U_BCH_INPUT_APB_CLK_ENABLE, + IMX_RAWNAND_U_GPMI_BCH_INPUT_BCH_CLK_ENABLE, + IMX_RAWNAND_U_GPMI_BCH_INPUT_GPMI_IO_CLK_ENABLE, + IMX_RAWNAND_U_GPMI_INPUT_APB_CLK_ENABLE, + IMX_SPDIF_CLK_ENABLE, + IMX_SSI1_CLK_ENABLE, + IMX_SSI2_CLK_ENABLE, + IMX_SSI3_CLK_ENABLE, + IMX_EIM_SLOW_CLK_ENABLE, + IMX_VDOAXICLK_CLK_ENABLE, + IMX_VPU_CLK_ENABLE, + }; + + ImxClkPwrSetClockGates ( + gatesToTurnOff, + sizeof (gatesToTurnOff) / sizeof (gatesToTurnOff[0]), + IMX_CLOCK_GATE_STATE_OFF); +} + +/** + Turn on required clocks, that are not handled by the PEP. +**/ +static VOID UngateRequiredClocks () +{ + static const IMX_CLK_GATE gatesToTurnOn[] =3D { + IMX_SDMA_CLK_ENABLE, + IMX_SPBA_CLK_ENABLE, + IMX_GPT_SERIAL_CLK_ENABLE, + IMX_USBOH3_CLK_ENABLE, + IMX_PWM1_CLK_ENABLE + }; + + ImxClkPwrSetClockGates( + gatesToTurnOn, + sizeof(gatesToTurnOn) / sizeof(gatesToTurnOn[0]), + IMX_CLOCK_GATE_STATE_ON); +} + +static void EnetInit () +{ + // Apply ENET pin-muxing configurations + ImxPadConfig(IMX_PAD_ENET_MDIO, IMX_PAD_ENET_MDIO_ENET_MDIO); = // pad ENET_MDIO (mode ALT1) + ImxPadConfig(IMX_PAD_ENET_MDC, IMX_PAD_ENET_MDC_ENET_MDC); = // pad ENET_MDC (mode ALT1) + ImxPadConfig(IMX_PAD_KEY_ROW4, IMX_PAD_CFG_KEY_ROW4_GPIO4_IO15); + ImxPadConfig(IMX_PAD_DI0_PIN2, IMX_PAD_DI0_PIN2_GPIO4_IO18); + ImxPadConfig(IMX_PAD_GPIO_16, IMX_PAD_GPIO_16_ENET_REF_CLK); + ImxPadConfig(IMX_PAD_ENET_REF_CLK, IMX_PAD_ENET_REF_CLK_ENET_REF_CLK); = // pad ENET_REF_CLK (mode ALT1) + ImxPadConfig(IMX_PAD_RGMII_TD0, IMX_PAD_RGMII_TD0_RGMII_TD0); = // RGMII_TD0 (ALT1) + ImxPadConfig(IMX_PAD_RGMII_TD1, IMX_PAD_RGMII_TD1_RGMII_TD1); = // RGMII_TD1 (ALT1) + ImxPadConfig(IMX_PAD_RGMII_TD2, IMX_PAD_RGMII_TD2_RGMII_TD2); = // RGMII_TD2 (ALT1) + ImxPadConfig(IMX_PAD_RGMII_TD3, IMX_PAD_RGMII_TD3_RGMII_TD3); = // RGMII_TD3 (ALT1) + ImxPadConfig(IMX_PAD_RGMII_TXC, IMX_PAD_RGMII_TXC_RGMII_TXC); = // pad RGMII_TXC (ALT1) + ImxPadConfig(IMX_PAD_RGMII_TX_CTL, IMX_PAD_RGMII_TX_CTL_RGMII_TX_CTL); = // RGMII_TX_CTL (ALT1) + + ImxPadConfig(IMX_PAD_RGMII_RD0, IMX_PAD_RGMII_RD0_ENET_RGMII_RD0); = // RGMII_RD0 (ALT1) + ImxPadConfig(IMX_PAD_RGMII_RD1, IMX_PAD_RGMII_RD1_ENET_RGMII_RD1); = // RGMII_RD1 (ALT1) + ImxPadConfig(IMX_PAD_RGMII_RD2, IMX_PAD_RGMII_RD2_ENET_RGMII_RD2); = // RGMII_RD2 (ALT1) + ImxPadConfig(IMX_PAD_RGMII_RD3, IMX_PAD_RGMII_RD3_ENET_RGMII_RD3); = // RGMII_RD3 (ALT1) + ImxPadConfig(IMX_PAD_RGMII_RXC, IMX_PAD_RGMII_RXC_ENET_RGMII_RXC); = // RGMII_RXC (ALT1) + ImxPadConfig(IMX_PAD_RGMII_RX_CTL, IMX_PAD_RGMII_RX_CTL_RGMII_RX_CTL); = // RGMII_RX_CTL (ALT1) + + // Enable ENET PLL, also required for PCIe + { + UINT32 counter =3D 0; + IMX_CCM_ANALOG_PLL_ENET_REG ccmAnalogPllReg; + volatile IMX_CCM_ANALOG_REGISTERS *ccmAnalogRegistersPtr =3D + (IMX_CCM_ANALOG_REGISTERS *)IMX_CCM_ANALOG_BASE; + + ccmAnalogPllReg.AsUint32 =3D MmioRead32((UINTN)&ccmAnalogRegistersPtr-= >PLL_ENET); + ccmAnalogPllReg.POWERDOWN =3D 0; + ccmAnalogPllReg.ENABLE =3D 1; + + MmioWrite32( + (UINTN)&ccmAnalogRegistersPtr->PLL_ENET, + ccmAnalogPllReg.AsUint32); + + do { + ccmAnalogPllReg.AsUint32 =3D + MmioRead32((UINTN)&ccmAnalogRegistersPtr->PLL_ENET); + + MicroSecondDelay(100); + ++counter; + } while ((ccmAnalogPllReg.LOCK =3D=3D 0) && (counter < 100)); + + // Enable PCIe output 125Mhz + ccmAnalogPllReg.BYPASS =3D 0; + ccmAnalogPllReg.ENABLE_125M =3D 1; + ccmAnalogPllReg.DIV_SELECT =3D PLL_ENET_DIV_SELECT_25MHZ; + + MmioWrite32( + (UINTN)&ccmAnalogRegistersPtr->PLL_ENET, + ccmAnalogPllReg.AsUint32); + + MicroSecondDelay(50000); + + if (ccmAnalogPllReg.LOCK =3D=3D 0) { + DEBUG ((DEBUG_ERROR, "PLL_ENET is not locked!\n")); + } + } +} + +/** + Set SSI3 clock dividers to provide a bit clock capable of + providing a clock suitable for stereo 44.1 KHz playback at 32 bit + from PLL3 PFD2 which runs at 508.2 MHz. + + We only need to scale down the PLL3 FPD2 clock by 1:15 to provide a + reference clock. The WDM audio class driver will later setup additional + dividers in the SSI3 block to provide the required bit clock rate. + + This routine also handles all GPIO/PadConfig init required for audio. +**/ +static void SetupAudio () +{ + volatile IMX_CCM_REGISTERS *ccmRegisters =3D (IMX_CCM_REGISTERS *) IMX_C= CM_BASE; + + IMX_CCM_CS1CDR_REG csicdr =3D (IMX_CCM_CS1CDR_REG) MmioRead32((UINTN) &c= cmRegisters->CS1CDR); + + csicdr.ssi3_clk_pred =3D 0; // divide by 1. + csicdr.ssi3_clk_podf =3D (15 - 1); // divide by 15. + + MmioWrite32((UINTN) &ccmRegisters->CS1CDR, csicdr.AsUint32); + + // Enable output on CCM_CLKO1, select pll3_sw_clk/2 as the source. + IMX_CCM_CCOSR_REG ccosr =3D (IMX_CCM_CCOSR_REG) MmioRead32((UINTN) &ccmR= egisters->CCOSR); + + ccosr.CLKO1_SEL =3D 0; + ccosr.CLKO1_DIV =3D 0; + ccosr.CLKO1_EN =3D 1; + + MmioWrite32((UINTN) &ccmRegisters->CCOSR, ccosr.AsUint32); + + // Set GPIO05 alt config to ALT3 (CCM_CLKO1). + // This clock drives the master clock for the audio codec. + ImxPadConfig(IMX_PAD_GPIO_5, IMX_PAD_CFG_GPIO_5_CCM_CLKO1); + + // Set alt config for KEY_COL0, KEY_ROW0, KEY_COL1, to ALT2 to select AU= D5_TXC/TXD/TXFS. + // DSP_DAT19 is set to ALT3 for AUD5_RXD. + ImxPadConfig(IMX_PAD_KEY_COL0, IMX_PAD_CFG_KEY_COL0_AUD5_TXC); + ImxPadConfig(IMX_PAD_KEY_ROW0, IMX_PAD_CFG_KEY_ROW0_AUD5_TXD); + ImxPadConfig(IMX_PAD_KEY_COL1, IMX_PAD_CFG_KEY_COL1_AUD5_TXFS); + ImxPadConfig(IMX_PAD_DISP0_DAT19, IMX_PAD_CFG_DISP0_DAT19_AUD5_RXD); +} + +/** + Initialize clock and power for modules on the SoC. +**/ +VOID ImxClkPwrInit () +{ + EFI_STATUS status; + + GateUnusedClocks(); + UngateRequiredClocks(); + + if (FeaturePcdGet (PcdGpuEnable)) { + status =3D ImxClkPwrGpuEnable (); + ASSERT_EFI_ERROR (status); + } + + if (FeaturePcdGet(PcdLvdsEnable)) { + status =3D ImxClkPwrIpuLDBxEnable (); + ASSERT_EFI_ERROR (status); + } + + status =3D ImxClkPwrIpuDIxEnable(); + ASSERT_EFI_ERROR (status); + + ASSERT_EFI_ERROR (ImxClkPwrValidateClocks ()); +} + +/** + Initialize SDHC modules on the SOC and perform required pin-muxing +**/ +VOID SdhcInit () +{ + // uSDHC2: SDCard Socket + ImxPadConfig(IMX_PAD_SD2_CLK, IMX_PAD_CFG_SD2_CLK_SD2_CLK); + ImxPadConfig(IMX_PAD_SD2_CMD, IMX_PAD_CFG_SD2_CMD_SD2_CMD); + ImxPadConfig(IMX_PAD_SD2_DAT0, IMX_PAD_CFG_SD2_DAT0_SD2_DATA0); + ImxPadConfig(IMX_PAD_SD2_DAT1, IMX_PAD_CFG_SD2_DAT1_SD2_DATA1); + ImxPadConfig(IMX_PAD_SD2_DAT2, IMX_PAD_CFG_SD2_DAT2_SD2_DATA2); + ImxPadConfig(IMX_PAD_SD2_DAT3, IMX_PAD_CFG_SD2_DAT3_SD2_DATA3); + ImxPadConfig(IMX_PAD_GPIO_4, IMX_PAD_CFG_GPIO_4_SD2_CD_B); + ImxPadConfig(IMX_PAD_KEY_ROW1, IMX_PAD_CFG_KEY_ROW1_SD2_VSELECT); + +#if DEBUG_SDHC_PINMUXING + DEBUG((DEBUG_INIT, "uSDHC2 PAD Config:\n")); + ImxPadDumpConfig("CLK",IMX_PAD_SD2_CLK); + ImxPadDumpConfig("CMD",IMX_PAD_SD2_CMD); + ImxPadDumpConfig("DAT0",IMX_PAD_SD2_DAT0); + ImxPadDumpConfig("DAT1",IMX_PAD_SD2_DAT1); + ImxPadDumpConfig("DAT2",IMX_PAD_SD2_DAT2); + ImxPadDumpConfig("DAT3",IMX_PAD_SD2_DAT3); + ImxPadDumpConfig("VSELECT",IMX_PAD_KEY_ROW1); + ImxPadDumpConfig("CD",IMX_PAD_GPIO_4); +#endif // DEBUG_SDHC_PINMUXING + + // Power-on SDCard through the GPIO signal connected to + // Q1 MOSFET Gate acting as a switch to SDCard VDD supply voltage + ImxPadConfig(IMX_PAD_DISP0_DAT9, IMX_PAD_CFG_DISP0_DAT9_GPIO4_IO30); + ImxGpioDirection(IMX_GPIO_BANK4, 30, IMX_GPIO_DIR_OUTPUT); + ImxGpioWrite(IMX_GPIO_BANK4, 30, IMX_GPIO_LOW); + + // Pre-configure the GPIO ALT5 of all SD2_* pads to be input pins. This = is + // required by the SD _DSM for slot power-cycle. The power-on/off _DSM n= eed to + // disconnect all SD pins as part of the power-off sequence. This will b= e + // achieved by switching the alternate function of the SD pads from ALT0= SD2_* + // to ALT5 GPIO1_IO* and disable the pull-up resistors. On power-on, the= SD2_* + // pads will be reconfigured as as ALT0 SD2_* functions and the pull-ups= will + // be enabled again. The net effect is that all the SD pins will float a= nd a + // proper SD power-cycle can be achieved. + + // SD2_CLK: GPIO1_IO10 + ImxGpioDirection(IMX_GPIO_BANK1, 10, IMX_GPIO_DIR_INPUT); + + // SD2_CMD: GPIO1_IO11 + ImxGpioDirection(IMX_GPIO_BANK1, 11, IMX_GPIO_DIR_INPUT); + + // SD2_DATA0: GPIO1_IO15 + ImxGpioDirection(IMX_GPIO_BANK1, 15, IMX_GPIO_DIR_INPUT); + + // SD2_DATA1: GPIO1_IO14 + ImxGpioDirection(IMX_GPIO_BANK1, 14, IMX_GPIO_DIR_INPUT); + + // SD2_DATA2: GPIO1_IO13 + ImxGpioDirection(IMX_GPIO_BANK1, 13, IMX_GPIO_DIR_INPUT); + + // SD2_DATA3: GPIO1_IO12 + ImxGpioDirection(IMX_GPIO_BANK1, 12, IMX_GPIO_DIR_INPUT); + + // uSDHC3: eMMC Socket + ImxPadConfig(IMX_PAD_SD3_CLK, IMX_PAD_CFG_SD3_CLK_SD3_CLK); + ImxPadConfig(IMX_PAD_SD3_CMD, IMX_PAD_CFG_SD3_CMD_SD3_CMD); + ImxPadConfig(IMX_PAD_SD3_RST, IMX_PAD_CFG_SD3_RST_SD3_RST); + ImxPadConfig(IMX_PAD_SD3_DAT0, IMX_PAD_CFG_SD3_DAT0_SD3_DATA0); + ImxPadConfig(IMX_PAD_SD3_DAT1, IMX_PAD_CFG_SD3_DAT1_SD3_DATA1); + ImxPadConfig(IMX_PAD_SD3_DAT2, IMX_PAD_CFG_SD3_DAT2_SD3_DATA2); + ImxPadConfig(IMX_PAD_SD3_DAT3, IMX_PAD_CFG_SD3_DAT3_SD3_DATA3); + ImxPadConfig(IMX_PAD_SD3_DAT4, IMX_PAD_CFG_SD3_DAT4_SD3_DATA4); + ImxPadConfig(IMX_PAD_SD3_DAT5, IMX_PAD_CFG_SD3_DAT5_SD3_DATA5); + ImxPadConfig(IMX_PAD_SD3_DAT6, IMX_PAD_CFG_SD3_DAT6_SD3_DATA6); + ImxPadConfig(IMX_PAD_SD3_DAT7, IMX_PAD_CFG_SD3_DAT7_SD3_DATA7); +} + +/** + Initialize EHCI modules on the SOC and perform required pin-muxing. + This routine also initializes PHY0(OTG) and PHY1 (USBH1). +**/ +VOID EhciInit () +{ + // Pin-mux OTG Over Current + ImxPadConfig(IMX_PAD_KEY_COL4, IMX_PAD_CFG_KEY_COL4_USB_OTG_OC); + + // Pin-mux and enable OTG power + ImxPadConfig(IMX_PAD_EIM_D22, IMX_PAD_CFG_EIM_DATA22_GPIO3_IO22_USB_OTG_= PWR); + ImxGpioDirection(IMX_GPIO_BANK3, 22, IMX_GPIO_DIR_OUTPUT); + ImxGpioWrite(IMX_GPIO_BANK3, 22, IMX_GPIO_HIGH); + + // Pin-mux and configure USB_OTG_ID as HOST! + ImxPadConfig(IMX_PAD_GPIO_1, IMX_PAD_CFG_GPIO01_USB_OTG_ID_HOST); + + // Configure USB_OTG_ID pin + volatile IMX_IOMUXC_GPR_REGISTERS* IoMuxGprRegsPtr =3D (IMX_IOMUXC_GPR_R= EGISTERS*)IOMUXC_GPR_BASE_ADDRESS; + IMX_IOMUXC_GPR1_REG IoMuxGpr1Reg =3D { MmioRead32((UINTN)&IoMuxGprRegsPt= r->GPR1) }; + IoMuxGpr1Reg.USB_OTG_ID_SEL =3D IMX_IOMUXC_GPR1_USB_OTG_ID_SEL_GPIO_1; + MmioWrite32((UINTN)&IoMuxGprRegsPtr->GPR1, IoMuxGpr1Reg.AsUint32); + + // Pin-mux and enable USBH1 power + ImxPadConfig(IMX_PAD_GPIO_0, IMX_PAD_CFG_GPIO0_GPIO1_IO0_USBH1_PWR); + ImxGpioDirection(IMX_GPIO_BANK1, 0, IMX_GPIO_DIR_OUTPUT); + ImxGpioWrite(IMX_GPIO_BANK1, 0, IMX_GPIO_HIGH); + + // Initialize PHY0 (OTG) + ImxUsbPhyInit(IMX_USBPHY0); + + // Initialize PHY1 (USBH1) + ImxUsbPhyInit(IMX_USBPHY1); +} + +/** + Initialize I2C modules on the SOC and perform required pin-muxing +**/ +VOID I2cInit () +{ + // Enable 1.8V and 3.3V power rails for sensors connected to I2C1. + // The SENSOR_PWR_EN on EIM_EB3 line powers the pullups on I2c1. + ImxPadConfig (IMX_PAD_EIM_EB3, IMX_PAD_CFG_EIM_EB3_GPIO2_IO31); + ImxGpioDirection(IMX_GPIO_BANK2, 31, IMX_GPIO_DIR_OUTPUT); + ImxGpioWrite(IMX_GPIO_BANK2, 31, IMX_GPIO_HIGH); // set GPIO2_IO31 to 1 + DEBUG ((DEBUG_INFO, "Mux IMX_PAD_EIM_EB3 to GPIO via Alt5 and set GPIO2_= IO31 to 1\r\n")); + + // Configure I2C1. EIM_D21 is I2C1_SCL and EIM_D28 is I2C1_SDA. Alt6, Al= t1 + ImxPadConfig (IMX_PAD_EIM_D21, IMX_PAD_CFG_EIM_D21_I2C1_SCL); + ImxPadConfig (IMX_PAD_EIM_D28, IMX_PAD_CFG_EIM_D28_I2C1_SDA); + DEBUG ((DEBUG_INFO, "I2C1 pin muxed via EIM D28,21\r\n")); + + // I2C2 is used by GOP/Windows display driver. Do not configure I2C2 SCL= via KEY_COL3, SDA via KEY_ROW3 + + // Configure I2C3 SCL via EIM_D17, SDA via EIM_D18. Inputs Alt6 + ImxPadConfig (IMX_PAD_EIM_D17, IMX_PAD_CFG_EIM_D17_I2C3_SCL); + ImxPadConfig (IMX_PAD_EIM_D18, IMX_PAD_CFG_EIM_D18_I2C3_SDA); + DEBUG ((DEBUG_INFO, "I2C3 pin muxed EIM_D17, 18\r\n")); +} + +/** + Initialize SPI modules on the SOC and perform required pin-muxing +**/ +VOID SpiInit () +{ + UINT32 RegValue; + // On Hummingboard only ESPI2 is exposed. + // Configure the return path for ECSPI2_MISO + RegValue =3D MmioRead32(IOMUXC_ECSPI2_MISO_SELECT_INPUT); + RegValue &=3D ~3; + RegValue |=3D (IMX_IOMUXC_ECSPI2_MISO_EIM_OE_B_ALT2 << 0); + MmioWrite32(IOMUXC_ECSPI2_MISO_SELECT_INPUT, RegValue); +} + +/** + Initialize PCI Express module on the SOC and perform required pin-muxing +**/ +VOID PcieInit () +{ + // PCIe GPIO Reset + ImxPadConfig(IMX_PAD_SD4_DAT3, IMX_PAD_CFG_SD4_DATA3_GPIO2_IO11); + ImxGpioDirection(IMX_GPIO_BANK2, 11, IMX_GPIO_DIR_OUTPUT); + ImxGpioWrite(IMX_GPIO_BANK2, 11, IMX_GPIO_LOW); +} + +/** + Initialize exposed GPIO pins on carrier board. By default some + pins are set to CMOS inputs while others are set to Schmitt + triggers. Normalize them all to Schmitt trigger inputs by setting + the hysteresis bit (16) in the pad ctl register. +**/ +VOID GpioInit () +{ + int i; + IMX_PAD gpioPins[] =3D { + IMX_PAD_ENET_RX_ER, + IMX_PAD_EIM_A22, + IMX_PAD_EIM_A21, + IMX_PAD_EIM_A20, + IMX_PAD_EIM_A19, + IMX_PAD_EIM_A18, + IMX_PAD_EIM_A17, + IMX_PAD_EIM_A16, + IMX_PAD_EIM_EB0, + IMX_PAD_EIM_EB1, + IMX_PAD_EIM_DA0, + IMX_PAD_EIM_DA1, + IMX_PAD_EIM_DA2, + IMX_PAD_EIM_DA3, + IMX_PAD_EIM_DA4, + IMX_PAD_EIM_DA5, + IMX_PAD_EIM_DA6, + IMX_PAD_EIM_DA7, + IMX_PAD_EIM_DA8, + IMX_PAD_EIM_DA9, + IMX_PAD_EIM_DA10, + IMX_PAD_EIM_DA11, + IMX_PAD_EIM_DA12, + IMX_PAD_EIM_DA13, + IMX_PAD_EIM_DA14, + IMX_PAD_EIM_DA15, + IMX_PAD_EIM_D26, + IMX_PAD_EIM_D27, + IMX_PAD_EIM_D30, + IMX_PAD_EIM_D31, + IMX_PAD_EIM_A24, + IMX_PAD_EIM_A23, + IMX_PAD_GPIO_16, + }; + + for (i =3D 0 ; i < sizeof(gpioPins)/sizeof(IMX_PAD) ; ++i) { + IMX_PAD pad =3D gpioPins[i]; + MmioOr32 ( + IMX_IOMUXC_BASE + _IMX_PAD_CTL_OFFSET(pad), + 1 << 16); + } +} + +/** + Initalize the PWM controllers + PWM1 is exposed through Mikrobus header + Pinmux pad DISP0_DAT8 to (ALT2) PWM1_OUT +**/ +VOID PwmInit () +{ + ImxPadConfig(IMX_PAD_DISP0_DAT8, IMX_PAD_CFG_DISP0_DAT8_PWM1_OUT); +} + +/** + Initalize the UART controllers +**/ +VOID UartInit () +{ + const IMX_CLK_GATE UartClockGatesToTurnOn[] =3D { + IMX_PLL3_MAIN_CLK, // IMX_UART_CLK_ENABLE, + IMX_UART_CLK_ROOT // UART_SERIAL_CLK_ENABLE, + }; + + // UARTs share same Clock: PLL3 (480 MHz) -> pll3_sw_clk -> CG -> /6 -= > uart_clk_root =3D 80 MHz + ImxClkPwrSetClockGates( + UartClockGatesToTurnOn, + sizeof(UartClockGatesToTurnOn) / sizeof(UartClockGatesToTurnOn[0])= , + IMX_CLOCK_GATE_STATE_ON); + + // Configure pin mux for UART 1 and UART 3 + ImxPadConfig (IMX_PAD_CSI0_DAT11, IMX_PAD_UART1_RX_DATA); + ImxPadConfig (IMX_PAD_CSI0_DAT10, IMX_PAD_UART1_TX_DATA); + ImxPadConfig (IMX_PAD_EIM_D25, IMX_PAD_UART3_RX_DATA); + ImxPadConfig (IMX_PAD_EIM_D24, IMX_PAD_UART3_TX_DATA); + + SerialPortInitialize (); + SerialPortWrite ( + (UINT8*)SERIAL_DEBUG_PORT_INIT_MSG, + (UINTN)sizeof(SERIAL_DEBUG_PORT_INIT_MSG)); +} + +/** + Initialize the TPM2 control area. + +Note: + This is temporary, and is normally done in TPM2 OPTEE device lib, + which will takle place as soon as the TreeDxe driver is enabled. +**/ +VOID +Tpm2AcpiControlAreaInit () +{ + EFI_PHYSICAL_ADDRESS BaseAddress; + UINT32 BufferSize; + EFI_TPM2_ACPI_CONTROL_AREA *ControlArea; + + BaseAddress =3D PcdGet64 (PcdTpm2AcpiBufferBase); + BufferSize =3D PcdGet32 (PcdTpm2AcpiBufferSize); + + if ((BaseAddress =3D=3D 0) || (BufferSize =3D=3D 0)) { + // + // TPM not enabled + // + return; + } + + ASSERT (BufferSize >=3D EFI_PAGE_SIZE * 3); + + ControlArea =3D (EFI_TPM2_ACPI_CONTROL_AREA *)((UINTN)BaseAddress); + ZeroMem(ControlArea, sizeof(EFI_TPM2_ACPI_CONTROL_AREA)); + BufferSize =3D EFI_PAGE_SIZE; + ControlArea->Command =3D (UINT64)((UINTN)(ControlArea + 1)); + ControlArea->CommandSize =3D BufferSize; + ControlArea->Response =3D ControlArea->Command + BufferSize; + ControlArea->ResponseSize =3D BufferSize; +} + +/** + Initalize LVDS +**/ +VOID LvdsInit () +{ + volatile IMX_CCM_REGISTERS *ccmRegisters =3D (IMX_CCM_REGISTERS *) IMX= _CCM_BASE; + + IMX_CCM_CCGR3_REG ccgr3 =3D (IMX_CCM_CCGR3_REG) MmioRead32((UINTN) &cc= mRegisters->CCGR[3]); + ccgr3.ldb_di0_clk_enable =3D 0x3; + MmioWrite32((UINTN) &ccmRegisters->CCGR[3], ccgr3.AsUint32); + + // initalize backlight pin + ImxPadConfig(IMX_PAD_SD4_DAT1, IMX_PAD_CFG_SD4_DATA1_GPIO2_IO09); + ImxGpioDirection(IMX_GPIO_BANK2, 9, IMX_GPIO_DIR_OUTPUT); + ImxGpioWrite(IMX_GPIO_BANK2, 9, IMX_GPIO_HIGH); +} + +/** + Initialize controllers that must setup at the early stage for iMX6 Quad +**/ +RETURN_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + if (!ArmPlatformIsPrimaryCore (MpId)) { + return RETURN_SUCCESS; + } + + ImxClkPwrInit (); + + // initialize default UEFI debug port early so we can use its debug outp= ut + SerialPortInitialize (); + SerialPortWrite ( + (UINT8 *)SERIAL_DEBUG_PORT_INIT_MSG, + (UINTN)sizeof(SERIAL_DEBUG_PORT_INIT_MSG)); + + // Initialize timer early on because the following init path will be cal= ling + // delay functions. PrePi.c calls ArmPlatformInitialize before it calls + // TimerConstructor to initialize the timer. + TimerConstructor (); + + SdhcInit (); + EhciInit (); + EnetInit (); + I2cInit (); + SpiInit (); + PcieInit (); + SetupAudio (); + GpioInit (); + PwmInit (); + + if (FeaturePcdGet(PcdLvdsEnable)) { + LvdsInit (); + } + + Tpm2AcpiControlAreaInit (); + + return RETURN_SUCCESS; +} + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} diff --git a/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Library/iMX6Board= Lib/iMX6BoardLib.inf b/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Library= /iMX6BoardLib/iMX6BoardLib.inf new file mode 100644 index 000000000000..2df33de7a9fa --- /dev/null +++ b/Platform/SolidRun/HummingboardEdge_iMX6Q_2GB/Library/iMX6BoardLib/iMX= 6BoardLib.inf @@ -0,0 +1,96 @@ +#/* @file +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may = be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +#*/ + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D iMX6BoardLib + FILE_GUID =3D 736343a0-1d96-11e0-aaaa-0002a5d5c51b + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ArmPlatformLib + DEFINE BOARD_LIB_COMMON_DIR =3D Silicon/NXP/iMX6Pkg/Library/iMX6Board= Lib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + Silicon/NXP/iMXPlatformPkg/iMXPlatformPkg.dec + Silicon/NXP/iMX6Pkg/iMX6Pkg.dec + Silicon/NXP/iMXPlatformPkg/iMXPlatformPkg.dec + Platform/Microsoft/OpteeClientPkg/OpteeClientPkg.dec + +[LibraryClasses] + IoLib + ArmLib + MemoryAllocationLib + SerialPortLib + iMX6ClkPwrLib + iMX6UsbPhyLib + +[Sources.common] + $(BOARD_LIB_COMMON_DIR)/iMX6BoardHelper.S | GCC + $(BOARD_LIB_COMMON_DIR)/iMX6BoardMem.c + $(BOARD_LIB_COMMON_DIR)/iMX6QBoardCoreDef.c + iMX6BoardInit.c + +[FeaturePcd] + giMX6TokenSpaceGuid.PcdGpuEnable + giMX6TokenSpaceGuid.PcdLvdsEnable + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + gArmPlatformTokenSpaceGuid.PcdCoreCount + + giMX6TokenSpaceGuid.PcdFrameBufferBase + giMX6TokenSpaceGuid.PcdFrameBufferSize + + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore + + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + + giMX6TokenSpaceGuid.PcdSrcBase + + giMXPlatformTokenSpaceGuid.PcdGpioBankMemoryRange + + # + # TrustZone private memory (?Mb OPTEE + ?Mb PSCI) + # This memory is managed privately by the OpTEE OS. + # It must match OpTEE optee_os/core/arch/arm/plat-imx/platform_config.h: + # CFG_DDR_TEETZ_RESERVED_START & CFG_DDR_TEETZ_RESERVED_START + # + gOpteeClientPkgTokenSpaceGuid.PcdTrustZonePrivateMemoryBase + gOpteeClientPkgTokenSpaceGuid.PcdTrustZonePrivateMemorySize + + # + # TrustZone shared memory + # This memory is manager by the normal world but shared with the OpTEE O= S. + # It must match OpTEE optee_os/core/arch/arm/plat-imx/platform_config.h: + # CFG_SHMEM_START & CFG_SHMEM_SIZE + # + gOpteeClientPkgTokenSpaceGuid.PcdTrustZoneSharedMemoryBase + gOpteeClientPkgTokenSpaceGuid.PcdTrustZoneSharedMemorySize + + # + # Temporary: TPM2 control area + # + gOpteeClientPkgTokenSpaceGuid.PcdTpm2AcpiBufferBase + gOpteeClientPkgTokenSpaceGuid.PcdTpm2AcpiBufferSize + --=20 2.16.2.gvfs.1.33.gf5370f1