From patchwork Sat Jan 23 09:20:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8096351 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 89DFBBEEE5 for ; Sat, 23 Jan 2016 09:29:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3517205B5 for ; Sat, 23 Jan 2016 09:29:04 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C814A205B1 for ; Sat, 23 Jan 2016 09:29:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMuTQ-0000qe-Aj; Sat, 23 Jan 2016 09:27:12 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aMuTP-0000qA-GF for xen-devel@lists.xen.org; Sat, 23 Jan 2016 09:27:11 +0000 Received: from [193.109.254.147] by server-16.bemta-14.messagelabs.com id 73/6A-15991-E6743A65; Sat, 23 Jan 2016 09:27:10 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-11.tower-27.messagelabs.com!1453541224!10274615!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7964 invoked from network); 23 Jan 2016 09:27:09 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-11.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 23 Jan 2016 09:27:09 -0000 Received: from 172.24.1.51 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.51]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DDP82363; Sat, 23 Jan 2016 17:22:37 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.235.1; Sat, 23 Jan 2016 17:22:25 +0800 From: Shannon Zhao To: Date: Sat, 23 Jan 2016 17:20:11 +0800 Message-ID: <1453540813-15764-20-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1453540813-15764-1-git-send-email-zhaoshenglong@huawei.com> References: <1453540813-15764-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.56A3465E.000A, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 557bcbf2b10e30c991505ab3d8a0492c Cc: ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, peter.huangpeng@huawei.com, julien.grall@citrix.com, stefano.stabellini@citrix.com, shannon.zhao@linaro.org Subject: [Xen-devel] [PATCH v4 19/21] arm/acpi: Initialize serial port from ACPI SPCR table X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shannon Zhao Parse ACPI SPCR (Serial Port Console Redirection table) table and initialize the serial port pl011. Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini --- V4: Add other fields of SPCR Interface type --- xen/drivers/char/pl011.c | 37 +++++++++++++++++++++++++++++++++++++ xen/include/acpi/actbl2.h | 9 +++++++++ 2 files changed, 46 insertions(+) diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c index 7e16294..9d47299 100644 --- a/xen/drivers/char/pl011.c +++ b/xen/drivers/char/pl011.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -308,6 +309,42 @@ DT_DEVICE_START(pl011, "PL011 UART", DEVICE_SERIAL) .init = pl011_dt_uart_init, DT_DEVICE_END +#ifdef CONFIG_ACPI +static int __init pl011_acpi_uart_init(const void *data) +{ + acpi_status status; + struct acpi_table_spcr *spcr = NULL; + int res; + + status = acpi_get_table(ACPI_SIG_SPCR, 0, + (struct acpi_table_header **)&spcr); + + if ( ACPI_FAILURE(status) ) + { + printk("pl011: Failed to get SPCR table\n"); + return -EINVAL; + } + + /* trigger/polarity information is not available in spcr */ + irq_set_type(spcr->interrupt, IRQ_TYPE_EDGE_BOTH); + + res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address, + PAGE_SIZE); + if ( res < 0 ) + { + printk("pl011: Unable to initialize\n"); + return res; + } + + return 0; +} + +ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL) + .class_type = ACPI_SPCR_TYPE_PL011, + .init = pl011_acpi_uart_init, +ACPI_DEVICE_END +#endif + /* * Local variables: * mode: C diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h index 87bc6b3..d0508be 100644 --- a/xen/include/acpi/actbl2.h +++ b/xen/include/acpi/actbl2.h @@ -815,6 +815,15 @@ struct acpi_table_spcr { #define ACPI_SPCR_DO_NOT_DISABLE (1) +/* SPCR Interface type */ +#define ACPI_SPCR_TYPE_16550 0 +#define ACPI_SPCR_TYPE_16550_SUB 0x1 +#define ACPI_SPCR_TYPE_PL011 0x3 +#define ACPI_SPCR_TYPE_SBSA_32 0xd +#define ACPI_SPCR_TYPE_SBSA 0xe +#define ACPI_SPCR_TYPE_DCC 0xf +#define ACPI_SPCR_TYPE_BCM2835 0x10 + /******************************************************************************* * * SPMI - Server Platform Management Interface table