From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Kyle Temkin <kyle@ktemkin.com>
Cc: julien.grall@arm.com, sstabellini@kernel.org,
"Kyle J. Temkin" <temkink@ainfosec.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH RFC 1/6] xen/arm: platforms: Add earlyprintk and serial support for Tegra boards.
Date: Tue, 13 Sep 2016 17:06:12 -0400 [thread overview]
Message-ID: <20160913210612.GD20469@char.us.oracle.com> (raw)
In-Reply-To: <20160905101401.7003-2-temkink@ainfosec.com>
On Mon, Sep 05, 2016 at 06:13:56AM -0400, Kyle Temkin wrote:
> From: "Kyle J. Temkin" <temkink@ainfosec.com>
>
> Tegra boards feature a NS16550-compatible serial mapped into the MMIO
> space. Add support for its use both as a full-featured serial port and
> as an earlyprintk driver.
>
> Adds a new "needs_rtoie" (requires Rx Timeout Interrupt) quirk, as some
> platforms-- including Tegra-- require the NS16550 Rx timeout interrupt
> to be enabled for receive to function properly. The same quirk is
> applied in the eqvuialent Linux driver [1].
>
> [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4539c24fe4f92c09ee668ef959d3e8180df619b9
>
> Signed-off-by: Kyle Temkin <temkink@ainfosec.com>
> ---
> xen/arch/arm/Rules.mk | 1 +
> xen/drivers/char/ns16550.c | 16 +++++++++++++++-
> xen/include/xen/8250-uart.h | 1 +
> 3 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
> index 93304be..2a1473a 100644
> --- a/xen/arch/arm/Rules.mk
> +++ b/xen/arch/arm/Rules.mk
> @@ -44,6 +44,7 @@ EARLY_PRINTK_vexpress := pl011,0x1c090000
> EARLY_PRINTK_xgene-mcdivitt := 8250,0x1c021000,2
> EARLY_PRINTK_xgene-storm := 8250,0x1c020000,2
> EARLY_PRINTK_zynqmp := cadence,0xff000000
> +EARLY_PRINTK_tegra := 8250,0x70006000,2
>
> ifneq ($(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)),)
> EARLY_PRINTK_CFG := $(subst $(comma), ,$(EARLY_PRINTK_$(CONFIG_EARLY_PRINTK)))
> diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
> index 1da103a..bffdb35 100644
> --- a/xen/drivers/char/ns16550.c
> +++ b/xen/drivers/char/ns16550.c
> @@ -64,6 +64,7 @@ static struct ns16550 {
> unsigned int timeout_ms;
> bool_t intr_works;
> bool_t dw_usr_bsy;
> + bool_t needs_rtoie;
Those three states all look like tri-states? Or could you potentially
have them independenty enabled? As in dw_usr_bsy and needs_rtoie?
> #ifdef CONFIG_HAS_PCI
> /* PCI card parameters. */
> bool_t pb_bdf_enable; /* if =1, pb-bdf effective, port behind bridge */
> @@ -652,12 +653,23 @@ static void ns16550_setup_postirq(struct ns16550 *uart)
> {
> if ( uart->irq > 0 )
> {
> + u8 ier_value = 0;
> +
> /* Master interrupt enable; also keep DTR/RTS asserted. */
> ns_write_reg(uart,
> UART_MCR, UART_MCR_OUT2 | UART_MCR_DTR | UART_MCR_RTS);
>
> /* Enable receive interrupts. */
> - ns_write_reg(uart, UART_IER, UART_IER_ERDAI);
> + ier_value = UART_IER_ERDAI;
> +
> + /*
> + * If we're on a platform that needs Rx timeouts enabled, also
> + * set Rx TimeOut Interrupt Enable (RTOIE).
> + */
> + if ( uart->needs_rtoie )
> + ier_value |= UART_IER_RTOIE;
> +
> + ns_write_reg(uart, UART_IER, ier_value);
> }
>
> if ( uart->irq >= 0 )
> @@ -1273,6 +1285,7 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
> uart->irq = res;
>
> uart->dw_usr_bsy = dt_device_is_compatible(dev, "snps,dw-apb-uart");
> + uart->needs_rtoie = dt_device_is_compatible(dev, "nvidia,tegra20-uart");
>
> uart->vuart.base_addr = uart->io_base;
> uart->vuart.size = uart->io_size;
> @@ -1293,6 +1306,7 @@ static const struct dt_device_match ns16550_dt_match[] __initconst =
> DT_MATCH_COMPATIBLE("ns16550"),
> DT_MATCH_COMPATIBLE("ns16550a"),
> DT_MATCH_COMPATIBLE("snps,dw-apb-uart"),
> + DT_MATCH_COMPATIBLE("nvidia,tegra20-uart"),
> { /* sentinel */ },
> };
>
> diff --git a/xen/include/xen/8250-uart.h b/xen/include/xen/8250-uart.h
> index c6b62c8..2ad0ee6 100644
> --- a/xen/include/xen/8250-uart.h
> +++ b/xen/include/xen/8250-uart.h
> @@ -41,6 +41,7 @@
> #define UART_IER_ETHREI 0x02 /* tx reg. empty */
> #define UART_IER_ELSI 0x04 /* rx line status */
> #define UART_IER_EMSI 0x08 /* MODEM status */
> +#define UART_IER_RTOIE 0x10 /* rx timeout */
>
> /* Interrupt Identificatiegister */
> #define UART_IIR_NOINT 0x01 /* no interrupt pending */
> --
> 2.9.2
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-09-13 21:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 10:13 [PATCH RFC 0/6] ARM: Add support for Tegra SoCs (incl. Jetson TK1, Jetson TX1) Kyle Temkin
2016-09-05 10:13 ` [PATCH RFC 1/6] xen/arm: platforms: Add earlyprintk and serial support for Tegra boards Kyle Temkin
2016-09-13 21:06 ` Konrad Rzeszutek Wilk [this message]
2016-10-21 21:41 ` Stefano Stabellini
2016-09-05 10:13 ` [PATCH RFC 2/6] xen/arm: hwdom GIC: inherit interrupt parent from host device tree Kyle Temkin
2016-10-21 22:18 ` Stefano Stabellini
2016-09-05 10:13 ` [PATCH RFC 3/6] xen/arm: Allow platforms to hook IRQ routing Kyle Temkin
2016-10-21 23:28 ` Stefano Stabellini
2016-11-01 14:56 ` Julien Grall
2016-09-05 10:13 ` [PATCH RFC 4/6] xen/arm: platforms: Add Tegra platform to support basic " Kyle Temkin
2016-09-16 14:50 ` Konrad Rzeszutek Wilk
2016-10-22 0:06 ` Stefano Stabellini
2016-09-05 10:14 ` [PATCH RFC 5/6] xen/arm: Add function to query IRQ 'ownership' Kyle Temkin
2016-09-16 14:53 ` Konrad Rzeszutek Wilk
2016-10-22 0:10 ` Stefano Stabellini
2016-09-05 10:14 ` [PATCH RFC 6/6] xen/arm: platforms/tegra: ensure the hwdom can only affect its own interrupts Kyle Temkin
2016-10-22 0:45 ` Stefano Stabellini
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=20160913210612.GD20469@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=julien.grall@arm.com \
--cc=kyle@ktemkin.com \
--cc=sstabellini@kernel.org \
--cc=temkink@ainfosec.com \
--cc=xen-devel@lists.xen.org \
/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;
as well as URLs for NNTP newsgroup(s).