From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Jun Nie <jun.nie@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
Evan Lloyd <evan.lloyd@arm.com>,
Alexei Fedorov <Alexei.Fedorov@arm.com>,
Shawn Guo <shawn.guo@linaro.org>,
jason.liu@linaro.org
Subject: Re: [PATCH] ArmPlatformPkg: Support different reg offset to PL011
Date: Mon, 3 Jul 2017 11:58:35 +0100 [thread overview]
Message-ID: <CAKv+Gu91t+xMDY5RMETgCPO51TqP6kJ8QVyb=8aps1mM+=i9fw@mail.gmail.com> (raw)
In-Reply-To: <1499050106-12875-1-git-send-email-jun.nie@linaro.org>
On 3 July 2017 at 03:48, Jun Nie <jun.nie@linaro.org> wrote:
> ZTE SoC has different offset for some registers and bits.
> Add a macro flag to undef/redef those value. The macro
> flag can be enabled in BuildOptions section of platform.dsc.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
Please use a single UINT8 type fixed PCD to configure whether your
alternative register mapping should be used. You can test its value
using preprocessor conditionals, e.g.,
#if !FixedPcdget8 (xxxx)
#else
#endif
> ---
> ArmPlatformPkg/Include/Drivers/PL011Uart.h | 40 ++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/ArmPlatformPkg/Include/Drivers/PL011Uart.h b/ArmPlatformPkg/Include/Drivers/PL011Uart.h
> index d5e88e8..87fab60 100644
> --- a/ArmPlatformPkg/Include/Drivers/PL011Uart.h
> +++ b/ArmPlatformPkg/Include/Drivers/PL011Uart.h
> @@ -40,6 +40,34 @@
> #define UARTPID2 0xFE8
> #define UARTPID3 0xFEC
>
> +#ifdef ZX_PL011_FLAG
> +#undef UARTDR
> +#undef UARTFR
> +#undef UARTIBRD
> +#undef UARTFBRD
> +#undef UARTLCR_H
> +#undef UARTCR
> +#undef UARTIFLS
> +#undef UARTIMSC
> +#undef UARTRIS
> +#undef UARTMIS
> +#undef UARTICR
> +#undef UARTDMACR
> +
Please don't use #undef and redefine. Create two equivalent blocks
instead, one with the default values and one with the alternative
values.
> +#define UARTDR 0x004
> +#define UARTFR 0x014
> +#define UARTIBRD 0x024
> +#define UARTFBRD 0x028
> +#define UARTLCR_H 0x030
> +#define UARTCR 0x034
> +#define UARTIFLS 0x038
> +#define UARTIMSC 0x040
> +#define UARTRIS 0x044
> +#define UARTMIS 0x048
> +#define UARTICR 0x04c
> +#define UARTDMACR 0x050
> +#endif
> +
> // Data status bits
> #define UART_DATA_ERROR_MASK 0x0F00
>
> @@ -57,6 +85,18 @@
> #define PL011_UARTFR_DSR (1 << 1) // Data set ready
> #define PL011_UARTFR_CTS (1 << 0) // Clear to send
>
> +#ifdef ZX_PL011_FLAG
> +#undef PL011_UARTFR_RI
> +#undef PL011_UARTFR_BUSY
> +#undef PL011_UARTFR_DSR
> +#undef PL011_UARTFR_CTS
> +
> +#define PL011_UARTFR_RI 0x001 // Ring indicator
> +#define PL011_UARTFR_BUSY 0x100 // UART busy
> +#define PL011_UARTFR_DSR 0x008 // Data set ready
> +#define PL011_UARTFR_CTS 0x002 // Clear to send
Please use the same style to define the constants (1 << n)
prev parent reply other threads:[~2017-07-03 10:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 2:48 [PATCH] ArmPlatformPkg: Support different reg offset to PL011 Jun Nie
2017-07-03 10:58 ` Ard Biesheuvel [this message]
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='CAKv+Gu91t+xMDY5RMETgCPO51TqP6kJ8QVyb=8aps1mM+=i9fw@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