From nobody Thu May 2 00:32:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+71035+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71035+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1612220029; cv=none; d=zohomail.com; s=zohoarc; b=GypvEdsCOqGSBlqSAUjPY/jn25bvyKS3c99JgvEU0ClQRtt6i44RSDOPmQBgT3oKdMXq0wgSoQOHqyO6001fu1OVWjy3SAoTXwJsjJc3elAEJLBaDSTwZpzz1hAYeAfH/5ORAypXO+B8HY3mWNH5q/zhGw/G24t7IpFBwITbdsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612220029; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=RF/zeUlkNkXsIsdlj6ab72xiSYop2brFYU7Rzkw+0oY=; b=cTNAuhIv6h+etoO/GkzfyfrisdV9knDSxYq1iUHlW+Hwia4x5H2+NEMx3gSTuDfpIAZ2btM8Td+prfy00LF8bRcKUOA8ZhtuFm5uI1wRN0EL8IDxeLmjurpxek/UUNr48qB0Gt/55nDbmoCG0A3aRcZ3dJtpu+/PiGUwN1Z+xxQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+71035+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1612220029867125.01070222488761; Mon, 1 Feb 2021 14:53:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id I3ldYY1788612xT9TaNk0yhC; Mon, 01 Feb 2021 14:53:49 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.43626.1612220028892929732 for ; Mon, 01 Feb 2021 14:53:49 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F6C4150C; Mon, 1 Feb 2021 14:53:48 -0800 (PST) X-Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.28.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6C4E53F718; Mon, 1 Feb 2021 14:53:48 -0800 (PST) From: "Jeremy Linton" To: devel@edk2.groups.io Cc: pete@akeo.ie, awarkentin@vmware.com, samer.el-haj-mahmoud@arm.com, leif@nuviainc.com, ardb+tianocore@kernel.org, Jeremy Linton Subject: [edk2-devel] [PATCH] Platform/RaspberryPi/Acpitables: Add eMMC2 device and tweak Arasan Date: Mon, 1 Feb 2021 16:53:41 -0600 Message-Id: <20210201225343.2001835-3-jeremy.linton@arm.com> In-Reply-To: <20210201225343.2001835-1-jeremy.linton@arm.com> References: <20210201225343.2001835-1-jeremy.linton@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,jeremy.linton@arm.com X-Gm-Message-State: tffX00fo76NPqFEVOqEIXiIUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1612220029; bh=WhJFg/IOCnhdjFfbsyWHbt24ihkSnu7oeN66TUyiiw0=; h=Cc:Date:From:Reply-To:Subject:To; b=abBxTkcv2LohzQlRBJotkfHLjuhiz3qNyIu2NRlY+fXUIMQSGy6tMM61YVqf0Xyn8BA hzAC5J/jalnGPTz+9tQKyJe+hVF8+qdkxw8xhm8WORP9EWKN78hgvWp2+zT7rtHAcCG6d doh46+gH/Q2MJqkEzt62ha+rK3ZsRpetyis= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The primarly problem with the rpi Arasan controller working with a default SDHCI driver is the lack of a meaningful capabilities register. As such if we add a _DSD entry to provide that information, we can then bind it to the linux sdhci_iproc driver which already hardcodes the remaining controller bugs. Further we have gotten BRCME88C approved as the HID for the newer eMMC2 controller. So lets define an ACPI object to describe it. Of course both devices are sharing an interrupt so we should also indicate that in the table as well. Signed-off-by: Jeremy Linton Reviewed-by: Andrei Warkentin Reviewed-by: Pete Batard --- Platform/RaspberryPi/AcpiTables/AcpiTables.inf | 1 + Platform/RaspberryPi/AcpiTables/Emmc.asl | 131 +++++++++++++++++= ++++ Platform/RaspberryPi/AcpiTables/Sdhc.asl | 18 ++- Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 6 + 4 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 Platform/RaspberryPi/AcpiTables/Emmc.asl diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/Rasp= berryPi/AcpiTables/AcpiTables.inf index d2cce074e5..743261afcf 100644 --- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf @@ -35,6 +35,7 @@ Spcr.aslc Pptt.aslc SsdtThermal.asl + Emmc.asl =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/RaspberryPi/AcpiTables/Emmc.asl b/Platform/RaspberryP= i/AcpiTables/Emmc.asl new file mode 100644 index 0000000000..f089068556 --- /dev/null +++ b/Platform/RaspberryPi/AcpiTables/Emmc.asl @@ -0,0 +1,131 @@ +/** @file + * + * Copyright (c) 2021 Arm. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include +#include + +#include "AcpiTables.h" + +DefinitionBlock (__FILE__, "SSDT", 5, "RPIFDN", "RPI4EMMC", 2) +{ + Scope (\_SB_) + { +#if (RPI_MODEL =3D=3D 4) + Device (GDV1) { + Name (_HID, "ACPI0004") + Name (_UID, 0x0) + Name (_CCA, 0x0) + + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0, MMCHS2_LENGTH, RMEM) + }) + Method (_CRS, 0x0, Serialized) + { + MEMORY32SETBASE (RBUF, RMEM, RBAS, MMCHS2_OFFSET) + Return (^RBUF) + } + + Name (_DMA, ResourceTemplate() { + /* + * XHC0 is limited to DMA to first 3GB. Note this + * only applies to PCIe, not GENET or other devices + * next to the A72. + */ + QWordMemory (ResourceConsumer, + , + MinFixed, + MaxFixed, + NonCacheable, + ReadWrite, + 0x0, + 0x00000000C0000000, // MIN + 0x00000000FFFFFFFF, // MAX + 0xFFFFFFFF40000000, // TRA + 0x0000000040000000, // LEN + , + , + ) + }) + =20 + // emmc2 Host Controller. (brcm,bcm2711-emmc2) + Device (SDC3) + { + Name (_HID, "BRCME88C") + Name (_UID, 0x1) + Name (_CCA, 0x0) + Name (_S1D, 0x1) + Name (_S2D, 0x1) + Name (_S3D, 0x1) + Name (_S4D, 0x1) + Name (SDMA, 0x2) + Method (_STA) + { + Return(0xf) + } + Name (RBUF, ResourceTemplate () + { + MEMORY32FIXED (ReadWrite, 0, MMCHS2_LENGTH, RMEM) + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_MMCHS= 1_INTERRUPT } + }) + Method (_CRS, 0x0, Serialized) + { + MEMORY32SETBASE (RBUF, RMEM, RBAS, MMCHS2_OFFSET) + Return (^RBUF) + } + + // Unfortunatly this controller doesn't honor the + // standard sdhci voltage control registers + // (or at least linux's standard code can't=20 + // lower the voltage) So, UHS mode is disabled with caps + Name (DSD1, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "sdhci-caps-mask", 0x0000000500080000 }, + } + }) + // We also disable both SDMA and ADMA2 until the linux + // _DMA() mask/translate works properly + Name (DSD2, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "sdhci-caps-mask", 0x0000000504480000 }, + } + }) + Method (_DSD, 0x0, Serialized) + { + if (SDMA =3D=3D 0)=20 + { + return (^DSD2) + }=20 + else=20 + { + return (^DSD1) + } + } + + // + // A child device that represents the + // sd card, which is marked as non-removable. + // + Device (SDMM) + { + Method (_ADR) + { + Return (0) + } + Method (_RMV) // Is removable + { + Return (0) // 0 - fixed + } + } + } //SDC3 + } //GDV1 +#endif + } //\SB +} diff --git a/Platform/RaspberryPi/AcpiTables/Sdhc.asl b/Platform/RaspberryP= i/AcpiTables/Sdhc.asl index 0ab1ba27f2..0430ab7d2d 100644 --- a/Platform/RaspberryPi/AcpiTables/Sdhc.asl +++ b/Platform/RaspberryPi/AcpiTables/Sdhc.asl @@ -19,7 +19,7 @@ // Note: UEFI can use either SDHost or Arasan. We expose both to the OS. // =20 -// ArasanSD 3.0 SD Host Controller. +// ArasanSD 3.0 SD Host Controller. (brcm,bcm2835-sdhci) Device (SDC1) { Name (_HID, "BCM2847") @@ -37,7 +37,7 @@ Device (SDC1) Name (RBUF, ResourceTemplate () { MEMORY32FIXED (ReadWrite, 0, MMCHS1_LENGTH, RMEM) - Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_M= MCHS1_INTERRUPT } + Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { BCM2836_MMCH= S1_INTERRUPT } }) Method (_CRS, 0x0, Serialized) { @@ -45,6 +45,17 @@ Device (SDC1) Return (^RBUF) } =20 + // The standard CAPs registers on this controller + // appear to be 0, lets set some minimal defaults + // Since this cap doesn't indicate DMA capability + // we don't need a _DMA() + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package () { "sdhci-caps", 0x0100fa81 }, + } + }) + // // A child device that represents the // sd card, which is marked as non-removable. @@ -62,7 +73,7 @@ Device (SDC1) } } =20 - +#if (RPI_MODEL < 4) // Broadcom SDHost 2.0 SD Host Controller Device (SDC2) { @@ -105,3 +116,4 @@ Device (SDC2) } } } +#endif // !RPI4 diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index ca7533cbee..7f26f7b4be 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -738,6 +738,12 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] =3D { SsdtNameOpReplace }, { + SIGNATURE_64 ('R', 'P', 'I', '4', 'E', 'M', 'M', 'C'), + 0, + PcdToken(PcdSdIsArasan), + NULL + }, + { SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0), 0, 0, --=20 2.13.7 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#71035): https://edk2.groups.io/g/devel/message/71035 Mute This Topic: https://groups.io/mt/80300533/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-