public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG
@ 2017-02-13  7:52 Haojian Zhuang
  2017-02-13  7:53 ` [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function Haojian Zhuang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Haojian Zhuang @ 2017-02-13  7:52 UTC (permalink / raw)
  To: leif.lindholm, ard.biesheuvel, edk2-devel; +Cc: Haojian Zhuang

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 <haojian.zhuang@linaro.org>
---
 ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
index 0e2ea61..ff8bb3b 100644
--- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
+++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
@@ -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;
@@ -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:
@@ -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;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function
  2017-02-13  7:52 [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG Haojian Zhuang
@ 2017-02-13  7:53 ` Haojian Zhuang
  2017-02-13 12:59   ` Haojian Zhuang
  2017-02-16 11:34   ` Ard Biesheuvel
  2017-02-13 12:59 ` [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG Haojian Zhuang
  2017-02-16 11:23 ` Ard Biesheuvel
  2 siblings, 2 replies; 6+ messages in thread
From: Haojian Zhuang @ 2017-02-13  7:53 UTC (permalink / raw)
  To: leif.lindholm, ard.biesheuvel, edk2-devel; +Cc: Haojian Zhuang

When call PL061GetPins() or PL061SetPins(), should use GPIO_PIN_MASK(offset)
as parameter, not offset.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
index ff8bb3b..81b9f6d 100644
--- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
+++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
@@ -186,7 +186,7 @@ Get (
     return EFI_INVALID_PARAMETER;
   }
 
-  if (PL061GetPins (RegisterBase, Offset)) {
+  if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {
     *Value = 1;
   } else {
     *Value = 0;
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG
  2017-02-13  7:52 [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG Haojian Zhuang
  2017-02-13  7:53 ` [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function Haojian Zhuang
@ 2017-02-13 12:59 ` Haojian Zhuang
  2017-02-16 11:23 ` Ard Biesheuvel
  2 siblings, 0 replies; 6+ messages in thread
From: Haojian Zhuang @ 2017-02-13 12:59 UTC (permalink / raw)
  To: Leif Lindholm, edk2-devel@lists.01.org, Ard Biesheuvel

On 13 February 2017 at 15:52, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
> 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 <haojian.zhuang@linaro.org>
> ---
>  ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> index 0e2ea61..ff8bb3b 100644
> --- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> +++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> @@ -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;
> @@ -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:
> @@ -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;
> --
> 2.7.4
>

Correct Ard's email address.

Regards
Haojian


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function
  2017-02-13  7:53 ` [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function Haojian Zhuang
@ 2017-02-13 12:59   ` Haojian Zhuang
  2017-02-16 11:34   ` Ard Biesheuvel
  1 sibling, 0 replies; 6+ messages in thread
From: Haojian Zhuang @ 2017-02-13 12:59 UTC (permalink / raw)
  To: Leif Lindholm, edk2-devel@lists.01.org, Ard Biesheuvel

On 13 February 2017 at 15:53, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
> When call PL061GetPins() or PL061SetPins(), should use GPIO_PIN_MASK(offset)
> as parameter, not offset.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---
>  ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> index ff8bb3b..81b9f6d 100644
> --- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> +++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> @@ -186,7 +186,7 @@ Get (
>      return EFI_INVALID_PARAMETER;
>    }
>
> -  if (PL061GetPins (RegisterBase, Offset)) {
> +  if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {
>      *Value = 1;
>    } else {
>      *Value = 0;
> --
> 2.7.4
>

Correct Ard's email address.

Regards
Haojian


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG
  2017-02-13  7:52 [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG Haojian Zhuang
  2017-02-13  7:53 ` [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function Haojian Zhuang
  2017-02-13 12:59 ` [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG Haojian Zhuang
@ 2017-02-16 11:23 ` Ard Biesheuvel
  2 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2017-02-16 11:23 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: Leif Lindholm, edk2-devel@lists.01.org

On 13 February 2017 at 07:52, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
> 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 <haojian.zhuang@linaro.org>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> index 0e2ea61..ff8bb3b 100644
> --- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> +++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> @@ -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;
> @@ -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:
> @@ -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;
> --
> 2.7.4
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function
  2017-02-13  7:53 ` [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function Haojian Zhuang
  2017-02-13 12:59   ` Haojian Zhuang
@ 2017-02-16 11:34   ` Ard Biesheuvel
  1 sibling, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2017-02-16 11:34 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: Leif Lindholm, edk2-devel@lists.01.org

On 13 February 2017 at 07:53, Haojian Zhuang <haojian.zhuang@linaro.org> wrote:
> When call PL061GetPins() or PL061SetPins(), should use GPIO_PIN_MASK(offset)
> as parameter, not offset.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Pushed as

d164a0e31bf8 ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG
d176bb3c5c28 ArmPlatformPkg/PL061Gpio: fix the offset value in Get function

> ---
>  ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> index ff8bb3b..81b9f6d 100644
> --- a/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> +++ b/ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
> @@ -186,7 +186,7 @@ Get (
>      return EFI_INVALID_PARAMETER;
>    }
>
> -  if (PL061GetPins (RegisterBase, Offset)) {
> +  if (PL061GetPins (RegisterBase, GPIO_PIN_MASK(Offset))) {
>      *Value = 1;
>    } else {
>      *Value = 0;
> --
> 2.7.4
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-16 11:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13  7:52 [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG Haojian Zhuang
2017-02-13  7:53 ` [PATCH 2/2] ArmPlatformPkg/PL061Gpio: fix the offset value in Get function Haojian Zhuang
2017-02-13 12:59   ` Haojian Zhuang
2017-02-16 11:34   ` Ard Biesheuvel
2017-02-13 12:59 ` [PATCH 1/2] ArmPlatformPkg/PL061: remove duplicated PL061_GPIO_DATA_REG Haojian Zhuang
2017-02-16 11:23 ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox