From patchwork Mon Jul 29 13:19:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Hildebrand X-Patchwork-Id: 11063831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CB4214DB for ; Mon, 29 Jul 2019 13:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFC5026E38 for ; Mon, 29 Jul 2019 13:21:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4175286BC; Mon, 29 Jul 2019 13:21:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 888EE26E38 for ; Mon, 29 Jul 2019 13:21:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hs5Yp-0004WA-UB; Mon, 29 Jul 2019 13:19:31 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hs5Yo-0004Vy-Ua for xen-devel@lists.xenproject.org; Mon, 29 Jul 2019 13:19:30 +0000 X-Inumbo-ID: 7e3b0d5c-b203-11e9-8980-bc764e045a96 Received: from webmail.dornerworks.com (unknown [12.207.209.150]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id 7e3b0d5c-b203-11e9-8980-bc764e045a96; Mon, 29 Jul 2019 13:19:30 +0000 (UTC) From: Stewart Hildebrand To: Date: Mon, 29 Jul 2019 09:19:19 -0400 Message-ID: <6f94e7b0f1cfe98a640d7f9ff59f18f299fd0d7d.1564371527.git.stewart.hildebrand@dornerworks.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [172.27.12.5] X-ClientProxiedBy: Mcbain.dw.local (172.27.1.45) To Mcbain.dw.local (172.27.1.45) Subject: [Xen-devel] [PATCH v2 1/2] ns16550: Add compatible string for Raspberry Pi 4 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Andre Przywara Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Per the BCM2835 peripherals datasheet [1] page 10: "The UART core is build to emulate 16550 behaviour ... The implemented UART is not a 16650 compatible UART However as far as possible the first 8 control and status registers are laid out like a 16550 UART. Al 16550 register bits which are not supported can be written but will be ignored and read back as 0. All control bits for simple UART receive/ transmit operations are available." Additionally, Linux uses the 8250/16550 driver for the aux UART [2]. Unfortunately the brcm,bcm2835-aux-uart device tree binding doesn't have the reg-shift and reg-io-width properties [3]. Thus, the reg-shift and reg-io-width properties are inherent properties of this UART. Thanks to Andre Przywara for contributing the reg-shift and reg-io-width setting snippet. In my testing, I have relied on enable_uart=1 being set in config.txt, a configuration file read by the Raspberry Pi's firmware. With enable_uart=1, the firmware performs UART initialization. [1] https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835/BCM2835-ARM-Peripherals.pdf [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/tty/serial/8250/8250_bcm2835aux.c [3] https://www.kernel.org/doc/Documentation/devicetree/bindings/serial/brcm,bcm2835-aux-uart.txt Signed-off-by: Stewart Hildebrand Reviewed-by: Andre Przywara Tested-by: Andre Przywara Acked-by: Julien Grall --- xen/drivers/char/ns16550.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index e518f2d790..8667de6d67 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1585,6 +1585,12 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev, if ( uart->reg_width != 1 && uart->reg_width != 4 ) return -EINVAL; + if ( dt_device_is_compatible(dev, "brcm,bcm2835-aux-uart") ) + { + uart->reg_width = 4; + uart->reg_shift = 2; + } + res = platform_get_irq(dev, 0); if ( ! res ) return -EINVAL; @@ -1611,6 +1617,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("brcm,bcm2835-aux-uart"), { /* sentinel */ }, };