From: Marcin Wojtas <mw@semihalf.com>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org,
nadavh@marvell.com, neta@marvell.com, kostap@marvell.com,
jinghua@marvell.com, mw@semihalf.com, jsd@semihalf.com
Subject: [platforms: PATCH v2 06/10] Marvell/Library: MppLib: Take 0xFF placeholders into account
Date: Fri, 27 Oct 2017 03:13:48 +0200 [thread overview]
Message-ID: <1509066832-5285-7-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1509066832-5285-1-git-send-email-mw@semihalf.com>
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
The MppSel definition PCDs contain 0xFF placeholders for values that
should be left untouched. MppLib needs to be taught how to take those
into account.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
Platform/Marvell/Library/MppLib/MppLib.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/Platform/Marvell/Library/MppLib/MppLib.c b/Platform/Marvell/Library/MppLib/MppLib.c
index 383c820..297725f 100644
--- a/Platform/Marvell/Library/MppLib/MppLib.c
+++ b/Platform/Marvell/Library/MppLib/MppLib.c
@@ -79,18 +79,24 @@ SetRegisterValue (
BOOLEAN ReverseFlag
)
{
- UINT32 i, j, CtrlVal;
+ UINT32 i, j, CtrlVal, CtrlMask, PinIndex;
INTN Sign;
Sign = ReverseFlag ? -1 : 1;
for (i = 0; i < RegCount; i++) {
CtrlVal = 0;
+ CtrlMask = 0;
for (j = 0; j < MPP_PINS_PER_REG; j++) {
- CtrlVal |= MPP_PIN_VAL(7 * (UINTN) ReverseFlag + j * Sign,
- MppRegPcd[i][7 * (UINTN) ReverseFlag + j * Sign]);
+
+ PinIndex = 7 * (UINTN)ReverseFlag + j * Sign;
+
+ if (MppRegPcd[i][PinIndex] != 0xff) {
+ CtrlVal |= MPP_PIN_VAL(PinIndex, MppRegPcd[i][PinIndex]);
+ CtrlMask |= MPP_PIN_VAL(PinIndex, 0xf);
+ }
}
- MmioWrite32 (BaseAddr + 4 * i * Sign, CtrlVal);
+ MmioAndThenOr32 (BaseAddr + 4 * i * Sign, ~CtrlMask, CtrlVal);
}
}
--
2.7.4
next prev parent reply other threads:[~2017-10-27 1:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 1:13 [platforms: PATCH v2 00/10] Armada 7k/8k - misc improvements pt.2 Marcin Wojtas
2017-10-27 1:13 ` [platforms: PATCH v2 01/10] Marvell/Drivers: MvI2cDxe: Abort transaction immediately upon fail Marcin Wojtas
2017-10-27 14:28 ` Leif Lindholm
2017-10-27 1:13 ` [platforms: PATCH v2 02/10] Marvell/Drivers: MvI2cDxe: Fix returning status in MvI2cStartRequest Marcin Wojtas
2017-10-27 14:29 ` Leif Lindholm
2017-10-27 1:13 ` [platforms: PATCH v2 03/10] Marvell/Drivers: MvI2cDxe: Reduce bus occupation time Marcin Wojtas
2017-10-27 1:13 ` [platforms: PATCH v2 04/10] Marvell/Library: MppLib: Prevent overwriting PCD values Marcin Wojtas
2017-10-27 1:13 ` [platforms: PATCH v2 05/10] Marvell/Library: MppLib: Disable the stack protector Marcin Wojtas
2017-10-27 1:13 ` Marcin Wojtas [this message]
2017-10-27 14:30 ` [platforms: PATCH v2 06/10] Marvell/Library: MppLib: Take 0xFF placeholders into account Leif Lindholm
2017-10-27 1:13 ` [platforms: PATCH v2 07/10] Marvell/Drivers: Pp2Dxe: Change settings for the always-up link Marcin Wojtas
2017-10-27 14:36 ` Leif Lindholm
2017-10-27 14:49 ` Marcin Wojtas
2017-10-27 1:13 ` [platforms: PATCH v2 08/10] Marvell/Drivers: XenonDxe: Fix UHS signalling mode setting Marcin Wojtas
2017-10-27 14:37 ` Leif Lindholm
2017-10-27 1:13 ` [platforms: PATCH v2 09/10] Marvell/Drivers: XenonDxe: Allow overriding base clock frequency Marcin Wojtas
2017-10-27 14:51 ` Leif Lindholm
2017-10-27 15:30 ` Marcin Wojtas
2017-10-27 1:13 ` [platforms: PATCH v2 10/10] Marvell/Drivers: XenonDxe: Do not modify FIFO default values Marcin Wojtas
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=1509066832-5285-7-git-send-email-mw@semihalf.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