Skip to content

Commit

Permalink
ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG
Browse files Browse the repository at this point in the history
PL061_GPIO_DATA_REG offset is referenced in PL061EffectiveAddress ()
already. So remove the duplicated reference when invoke PL061GetPins ()
or PL061SetPins ().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <[email protected]>
Reviewed-by: Ard Biesheuvel <[email protected]>
  • Loading branch information
hzhuang1 authored and Ard Biesheuvel committed Feb 16, 2017
1 parent 31d7be0 commit d164a0e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Get (
return EFI_INVALID_PARAMETER;
}

if (PL061GetPins (RegisterBase + PL061_GPIO_DATA_REG, Offset)) {
if (PL061GetPins (RegisterBase, Offset)) {
*Value = 1;
} else {
*Value = 0;
Expand Down Expand Up @@ -239,14 +239,14 @@ Set (
// Set the corresponding direction bit to HIGH for output
MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK(Offset));
// Set the corresponding data bit to LOW for 0
PL061SetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset), 0);
PL061SetPins (RegisterBase, GPIO_PIN_MASK(Offset), 0);
break;

case GPIO_MODE_OUTPUT_1:
// Set the corresponding direction bit to HIGH for output
MmioOr8 (RegisterBase + PL061_GPIO_DIR_REG, GPIO_PIN_MASK(Offset));
// Set the corresponding data bit to HIGH for 1
PL061SetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset), 0xff);
PL061SetPins (RegisterBase, GPIO_PIN_MASK(Offset), 0xff);
break;

default:
Expand Down Expand Up @@ -297,7 +297,7 @@ GetMode (
// Check if it is input or output
if (MmioRead8 (RegisterBase + PL061_GPIO_DIR_REG) & GPIO_PIN_MASK(Offset)) {
// Pin set to output
if (PL061GetPins (RegisterBase + PL061_GPIO_DATA_REG, GPIO_PIN_MASK(Offset))) {
if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {
*Mode = GPIO_MODE_OUTPUT_1;
} else {
*Mode = GPIO_MODE_OUTPUT_0;
Expand Down

0 comments on commit d164a0e

Please sign in to comment.