From: Andre Przywara <andre.przywara@arm.com>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH 1/7] lib: arm: Discover ns16550a UART
Date: Thu, 24 Jan 2019 11:54:18 +0000 [thread overview]
Message-ID: <20190124115418.23e1def9@donnerap.cambridge.arm.com> (raw)
In-Reply-To: <20190124111634.4727-2-alexandru.elisei@arm.com>
On Thu, 24 Jan 2019 11:16:28 +0000
Alexandru Elisei <alexandru.elisei@arm.com> wrote:
> Add support for discovering the ns16550a UART from the device tree.
> This particular UART model is emulated by kvmtool.
Maybe we should mention that this happens to work because both UARTs
have their TX data register at offset 0, because they are by no means
"compatible" otherwise.
But that just a documentation issue, so:
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cheers,
Andre.
> ---
> lib/arm/io.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/lib/arm/io.c b/lib/arm/io.c
> index d2c1a07c19ee..35fc05aeb4db 100644
> --- a/lib/arm/io.c
> +++ b/lib/arm/io.c
> @@ -32,22 +32,26 @@ static volatile u8 *uart0_base = (u8
> *)UART_EARLY_BASE;
> static void uart0_init(void)
> {
> - const char *compatible = "arm,pl011";
> + const char *compatible[] = {"arm,pl011", "ns16550a"};
> struct dt_pbus_reg base;
> - int ret;
> + int i, ret;
>
> ret = dt_get_default_console_node();
> assert(ret >= 0 || ret == -FDT_ERR_NOTFOUND);
>
> if (ret == -FDT_ERR_NOTFOUND) {
>
> - ret = dt_pbus_get_base_compatible(compatible, &base);
> - assert(ret == 0 || ret == -FDT_ERR_NOTFOUND);
> + for (i = 0; i < ARRAY_SIZE(compatible); i++) {
> + ret =
> dt_pbus_get_base_compatible(compatible[i], &base);
> + assert(ret == 0 || ret == -FDT_ERR_NOTFOUND);
> +
> + if (ret == 0)
> + break;
> + }
>
> if (ret) {
> - printf("%s: %s not found in the device tree,
> "
> - "aborting...\n",
> - __func__, compatible);
> + printf("%s: Compatible UART not found in the
> device tree, "
> + "aborting...\n", __func__);
> abort();
> }
>
next prev parent reply other threads:[~2019-01-24 11:54 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 11:16 [kvm-unit-tests PATCH 0/7] arm/arm64: Add support for running under kvmtool Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 1/7] lib: arm: Discover ns16550a UART Alexandru Elisei
2019-01-24 11:54 ` Andre Przywara [this message]
2019-01-24 13:11 ` Andrew Jones
2019-01-25 14:07 ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 2/7] lib: arm: Remove warning about uart0_base mismatch Alexandru Elisei
2019-01-24 11:59 ` Andre Przywara
2019-01-24 12:37 ` Andrew Jones
2019-01-25 16:36 ` Alexandru Elisei
2019-01-25 16:47 ` Andrew Jones
2019-01-28 14:24 ` Alexandru Elisei
2019-01-28 16:31 ` Andrew Jones
2019-01-28 17:58 ` Andre Przywara
2019-01-29 10:32 ` Andrew Jones
2019-01-29 11:16 ` Alexandru Elisei
2019-01-29 12:23 ` Andrew Jones
2019-01-29 13:40 ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 3/7] lib: chr-testdev: Make chr_testdev_init() return status Alexandru Elisei
2019-01-24 12:56 ` Andrew Jones
2019-01-24 11:16 ` [kvm-unit-tests PATCH 4/7] lib: arm: Implement PSCI SYSTEM_OFF in psci_system_off() Alexandru Elisei
2019-01-24 13:01 ` Andrew Jones
2019-01-25 14:08 ` Alexandru Elisei
2019-01-25 14:25 ` Andrew Jones
2019-01-24 11:16 ` [kvm-unit-tests PATCH 5/7] lib: arm: Fallback to psci_system_off() in exit() Alexandru Elisei
2019-01-24 13:00 ` Andrew Jones
2019-01-24 13:35 ` Andrew Jones
2019-01-25 14:56 ` Alexandru Elisei
2019-01-25 15:31 ` Andrew Jones
2019-01-25 15:51 ` Alexandru Elisei
2019-01-25 16:05 ` Andrew Jones
2019-01-25 16:14 ` Andre Przywara
2019-01-25 16:44 ` Alexandru Elisei
2019-01-25 16:50 ` Andrew Jones
2019-01-25 14:18 ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 6/7] lib: argv: Implement argv_find() for test parameters Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 7/7] arm/arm64: Use argv_find() for test names Alexandru Elisei
2019-01-24 13:07 ` Andrew Jones
2019-01-24 13:43 ` Andre Przywara
2019-01-28 12:16 ` Alexandru Elisei
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-all 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=20190124115418.23e1def9@donnerap.cambridge.arm.com \
--to=andre.przywara@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
/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