[edk2] [PATCH 2/2] ArmPlatformPkg: Include PL011UartClock Lib

Udit Kumar posted 2 patches 7 years, 6 months ago
There is a newer version of this series
[edk2] [PATCH 2/2] ArmPlatformPkg: Include PL011UartClock Lib
Posted by Udit Kumar 7 years, 6 months ago
This patch includes, PL011UartClock lib.

In case of no implemenation of this Clock Lib,
Pcd value will be used for PL011 frequency.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
---
 ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c   | 5 +++--
 ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
index 6aa8063..c73e8db 100644
--- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
+++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
@@ -19,6 +19,7 @@
 
 #include <Library/IoLib.h>
 #include <Library/PcdLib.h>
+#include <Library/PL011UartClockLib.h>
 #include <Library/PL011UartLib.h>
 #include <Library/SerialPortLib.h>
 
@@ -48,7 +49,7 @@ SerialPortInitialize (
 
   return PL011UartInitializePort (
            (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
-           FixedPcdGet32 (PL011UartClkInHz),
+           ArmPlatformGetPL011ClockFreq(),
            &BaudRate,
            &ReceiveFifoDepth,
            &Parity,
@@ -156,7 +157,7 @@ SerialPortSetAttributes (
 {
   return PL011UartInitializePort (
            (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
-           FixedPcdGet32 (PL011UartClkInHz),
+           ArmPlatformGetPL011ClockFreq(),
            BaudRate,
            ReceiveFifoDepth,
            Parity,
diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
index 3683e06..5ce5b2f 100644
--- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
@@ -26,6 +26,7 @@
   PL011SerialPortLib.c
 
 [LibraryClasses]
+  PL011UartClockLib
   PL011UartLib
   PcdLib
 
-- 
1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 2/2] ArmPlatformPkg: Include PL011UartClock Lib
Posted by Ard Biesheuvel 7 years, 6 months ago
On 5 June 2018 at 19:59, Udit Kumar <udit.kumar@nxp.com> wrote:
> This patch includes, PL011UartClock lib.
>
> In case of no implemenation of this Clock Lib,
> Pcd value will be used for PL011 frequency.
>

Please improve the commit log. You are modifying the code to obtain
the PL011 baud clock frequency from a library instead of a PCD

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
> ---
>  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c   | 5 +++--
>  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf | 1 +
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> index 6aa8063..c73e8db 100644
> --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> @@ -19,6 +19,7 @@
>
>  #include <Library/IoLib.h>
>  #include <Library/PcdLib.h>
> +#include <Library/PL011UartClockLib.h>
>  #include <Library/PL011UartLib.h>
>  #include <Library/SerialPortLib.h>
>
> @@ -48,7 +49,7 @@ SerialPortInitialize (
>
>    return PL011UartInitializePort (
>             (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> -           FixedPcdGet32 (PL011UartClkInHz),
> +           ArmPlatformGetPL011ClockFreq(),
>             &BaudRate,
>             &ReceiveFifoDepth,
>             &Parity,
> @@ -156,7 +157,7 @@ SerialPortSetAttributes (
>  {
>    return PL011UartInitializePort (
>             (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> -           FixedPcdGet32 (PL011UartClkInHz),
> +           ArmPlatformGetPL011ClockFreq(),
>             BaudRate,
>             ReceiveFifoDepth,
>             Parity,
> diff --git a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> index 3683e06..5ce5b2f 100644
> --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> @@ -26,6 +26,7 @@
>    PL011SerialPortLib.c
>
>  [LibraryClasses]
> +  PL011UartClockLib
>    PL011UartLib
>    PcdLib
>

You need to add a library resolution to
ArmPlatformPkg/ArmPlatformPkg.dsc for this library or you will break
the build.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 2/2] ArmPlatformPkg: Include PL011UartClock Lib
Posted by Udit Kumar 7 years, 6 months ago
Thanks Ard 

> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Monday, June 11, 2018 3:37 PM
> To: Udit Kumar <udit.kumar@nxp.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>; edk2-devel@lists.01.org
> Subject: Re: [PATCH 2/2] ArmPlatformPkg: Include PL011UartClock Lib
> 
> On 5 June 2018 at 19:59, Udit Kumar <udit.kumar@nxp.com> wrote:
> > This patch includes, PL011UartClock lib.
> >
> > In case of no implemenation of this Clock Lib, Pcd value will be used
> > for PL011 frequency.
> >
> 
> Please improve the commit log. You are modifying the code to obtain the
> PL011 baud clock frequency from a library instead of a PCD

Ok 
 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
> > ---
> >  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c   | 5
> +++--
> >  ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf | 1
> > +
> >  2 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git
> > a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> > b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> > index 6aa8063..c73e8db 100644
> > --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> > +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.c
> > @@ -19,6 +19,7 @@
> >
> >  #include <Library/IoLib.h>
> >  #include <Library/PcdLib.h>
> > +#include <Library/PL011UartClockLib.h>
> >  #include <Library/PL011UartLib.h>
> >  #include <Library/SerialPortLib.h>
> >
> > @@ -48,7 +49,7 @@ SerialPortInitialize (
> >
> >    return PL011UartInitializePort (
> >             (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> > -           FixedPcdGet32 (PL011UartClkInHz),
> > +           ArmPlatformGetPL011ClockFreq(),
> >             &BaudRate,
> >             &ReceiveFifoDepth,
> >             &Parity,
> > @@ -156,7 +157,7 @@ SerialPortSetAttributes (  {
> >    return PL011UartInitializePort (
> >             (UINTN)FixedPcdGet64 (PcdSerialRegisterBase),
> > -           FixedPcdGet32 (PL011UartClkInHz),
> > +           ArmPlatformGetPL011ClockFreq(),
> >             BaudRate,
> >             ReceiveFifoDepth,
> >             Parity,
> > diff --git
> > a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> > b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> > index 3683e06..5ce5b2f 100644
> > --- a/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> > +++ b/ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
> > @@ -26,6 +26,7 @@
> >    PL011SerialPortLib.c
> >
> >  [LibraryClasses]
> > +  PL011UartClockLib
> >    PL011UartLib
> >    PcdLib
> >
> 
> You need to add a library resolution to
> ArmPlatformPkg/ArmPlatformPkg.dsc for this library or you will break the
> build.

I will do this, 

FYI,
With update in edk2-platform, my compile was ok for Juno and NXP boards 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel