public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: devel@edk2.groups.io, yuinyee.chew@starfivetech.com
Cc: mindachen1987 <minda.chen@starfivetech.com>,
	Sunil V L <sunilvl@ventanamicro.com>,
	 Leif Lindholm <quic_llindhol@quicinc.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	 Li Yong <yong.li@intel.com>,
	mindachen1987 <mindachen1986@starfivetech.com>
Subject: Re: [edk2-devel] [PATCH v3 2/5] DesignWare/DwEmmcDxe: Add CPU little endian option
Date: Wed, 22 Nov 2023 16:45:37 +0100	[thread overview]
Message-ID: <CAMj1kXG0n4kr38oOoiCB8U_tn8R3Kq4Zm4D4MiGGgD8ywmLikw@mail.gmail.com> (raw)
In-Reply-To: <20231103025131.1643-3-yuinyee.chew@starfivetech.com>

On Fri, 3 Nov 2023 at 03:52, John Chew <yuinyee.chew@starfivetech.com> wrote:
>
> From: mindachen1987 <minda.chen@starfivetech.com>
>
> Add PCD for little endian CPU. During RX, the endianess of data receive
> via DMA will be swap.
>

I take it this means that the IP can be synthesized in both little and
big endian versions, right? Is there no ID register in the hardware
you can derive this information from?

Using PCDs like this generally not preferred, as it interferes with
the driver model. However, this driver does not implement the driver
model to begin with, so I suppose there is no issue here in that
sense.


> Cc: Sunil V L <sunilvl@ventanamicro.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Li Yong <yong.li@intel.com>
> Co-authored-by: mindachen1987 <mindachen1986@starfivetech.com>
> Signed-off-by: John Chew <yuinyee.chew@starfivetech.com>
> ---
>  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|0x00000003
>    gDesignWareTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz|0x0|UINT32|0x00000004
>    gDesignWareTokenSpaceGuid.PcdDwEmmcDxeFifoDepth|0x0|UINT32|0x00000005
> +  gDesignWareTokenSpaceGuid.PcdDwEmmcDxeCPULittleEndian|FALSE|BOOLEAN|0x00000008
> diff --git a/Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.c b/Silicon/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 = DwEmmcWaitDmaComplete(This, 1);
>
> +  if (DWMCI_SD_READ_MASK(mDwEmmcArgument) && (FixedPcdGetBool (PcdDwEmmcDxeCPULittleEndian))) {
> +    Buffer[3] = SwapBytes32(Buffer[3]);
> +    Buffer[4] = 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
>
>  [Depex]
>    TRUE
> --
> 2.34.1
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111609): https://edk2.groups.io/g/devel/message/111609
Mute This Topic: https://groups.io/mt/102357273/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-11-22 15:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03  2:51 [edk2-devel] [PATCH v3 0/5] Designware MMCDXE changes and enhancement John Chew
2023-11-03  2:51 ` [edk2-devel] [PATCH v3 1/5] DesignWare/DwEmmcDxe: Enabled Internal IDMAC interrupt RX/TX register John Chew
2023-11-22 15:41   ` Ard Biesheuvel
2023-11-27  7:10     ` John Chew
2023-11-03  2:51 ` [edk2-devel] [PATCH v3 2/5] DesignWare/DwEmmcDxe: Add CPU little endian option John Chew
2023-11-22 15:45   ` Ard Biesheuvel [this message]
2023-11-27  7:09     ` John Chew
2023-11-03  2:51 ` [edk2-devel] [PATCH v3 3/5] DesignWare/DwEmmcDxe: Remove ARM dependency library John Chew
2023-11-22 15:46   ` Ard Biesheuvel
2023-11-03  2:51 ` [edk2-devel] [PATCH v3 4/5] DesignWare/DwEmmcDxe: Add handling for SDMMC John Chew
2023-11-22 15:47   ` Ard Biesheuvel
2023-11-03  2:51 ` [edk2-devel] [PATCH v3 5/5] DesignWare/DwEmmcDxe: Force DMA buffer to allocate below 4GB John Chew
2023-11-22 15:49   ` Ard Biesheuvel
2023-11-07  1:09 ` [edk2-devel] [PATCH v3 0/5] Designware MMCDXE changes and enhancement John Chew
2023-11-22  4:06 ` John Chew

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMj1kXG0n4kr38oOoiCB8U_tn8R3Kq4Zm4D4MiGGgD8ywmLikw@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox