From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 4986C7803E1 for ; Mon, 23 Oct 2023 07:18:32 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5NzP/dBPDlSQZmS2ygq278s9hOIXjIC45sI/SAusCRc=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1698045511; v=1; b=tALM7OFSMRscOnNjn03ljP+aA4LXEHRcfQbYDopEStsCCW0I+ZVKN6Olf9Rww223olqEUHdz UcoUGo4/+egIXLEZYEuxuhIXL/KiU9dB9hcE9QxwFrDlLbq1RgPzS0JofaghOd9/4y3U94We7eI 4Wj31AKGdCi1iHxokDQqg36M= X-Received: by 127.0.0.2 with SMTP id XcKJYY7687511xkrFjif59cD; Mon, 23 Oct 2023 00:18:31 -0700 X-Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by mx.groups.io with SMTP id smtpd.web10.115204.1698045509340542732 for ; Mon, 23 Oct 2023 00:18:30 -0700 X-Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 5D08724E289; Mon, 23 Oct 2023 15:18:27 +0800 (CST) X-Received: from EXMBX073.cuchost.com (172.16.6.83) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 23 Oct 2023 15:18:27 +0800 X-Received: from localhost.localdomain (202.188.176.82) by EXMBX073.cuchost.com (172.16.6.83) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 23 Oct 2023 15:18:23 +0800 From: "John Chew" To: CC: mindachen1987 , Sunil V L , Leif Lindholm , Michael D Kinney , "Cc : Li Yong" , mindachen1987 , "John Chew" Subject: [edk2-devel] [PATCH v2 2/5] DesignWare/DwEmmcDxe: Add CPU little endian option Date: Mon, 23 Oct 2023 15:17:12 +0800 Message-ID: <20231023071715.777-3-yuinyee.chew@starfivetech.com> In-Reply-To: <20231023071715.777-1-yuinyee.chew@starfivetech.com> References: <20231023071715.777-1-yuinyee.chew@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [202.188.176.82] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX073.cuchost.com (172.16.6.83) X-YovoleRuleAgent: yovoleflag Precedence: Bulk List-Subscribe: List-Help: 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,yuinyee.chew@starfivetech.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: SNpCI6dLHbTQXesjn4B1GqMex7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=tALM7OFS; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: mindachen1987 Add PCD for little endian CPU. During RX, the endianess of data receive via DMA will be swap. Cc: Sunil V L Cc: Leif Lindholm Cc: Michael D Kinney Cc: Cc: Li Yong Co-authored-by: mindachen1987 Signed-off-by: John Chew --- Silicon/Synopsys/DesignWare/DesignWare.dec | 1 + Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.c | 5 +++++ Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.inf | 1 + 3 files changed, 7 insertions(+) diff --git a/Silicon/Synopsys/DesignWare/DesignWare.dec b/Silicon/Synopsys/= DesignWare/DesignWare.dec index f7ec7927543c..751370a8b1af 100755 --- a/Silicon/Synopsys/DesignWare/DesignWare.dec +++ b/Silicon/Synopsys/DesignWare/DesignWare.dec @@ -31,3 +31,4 @@ [PcdsFixedAtBuild.common] gDesignWareTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz|0x0|UINT32|0x00= 000003 gDesignWareTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz|0x0|UINT32|0x0000= 0004 gDesignWareTokenSpaceGuid.PcdDwEmmcDxeFifoDepth|0x0|UINT32|0x00000005 + gDesignWareTokenSpaceGuid.PcdDwEmmcDxeCPULittleEndian|FALSE|BOOLEAN|0x00= 000008 diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.c b/Si= licon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.c index 7ac286c5f361..edda28a45d7c 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.c +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.c @@ -588,6 +588,11 @@ DwEmmcReadBlockData ( } Status =3D DwEmmcWaitDmaComplete(This, 1); =20 + if (DWMCI_SD_READ_MASK(mDwEmmcArgument) && (FixedPcdGetBool (PcdDwEmmcDx= eCPULittleEndian))) { + Buffer[3] =3D SwapBytes32(Buffer[3]); + Buffer[4] =3D SwapBytes32(Buffer[4]); + } + out: // Restore Tpl gBS->RestoreTPL (Tpl); diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.inf b/= Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.inf index 7f70fe1e2a38..18c84a4172f9 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.inf +++ b/Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.inf @@ -51,6 +51,7 @@ [Pcd] gDesignWareTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz gDesignWareTokenSpaceGuid.PcdDwEmmcDxeFifoDepth gDesignWareTokenSpaceGuid.PcdDwPermitObsoleteDrivers + gDesignWareTokenSpaceGuid.PcdDwEmmcDxeCPULittleEndian =20 [Depex] TRUE --=20 2.34.1 -=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 (#109892): https://edk2.groups.io/g/devel/message/109892 Mute This Topic: https://groups.io/mt/102130687/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-